Spaces:
Sleeping
Sleeping
Fix prediction str -> list_of_list
Browse files- app.py +5 -2
- utilities.py +2 -1
app.py
CHANGED
@@ -734,6 +734,8 @@ with gr.Blocks(theme='shivi/calm_seafoam', css_paths='style.css', js=js_func) as
|
|
734 |
metrics_conc = target_df
|
735 |
if 'valid_efficency_score' not in metrics_conc.columns:
|
736 |
metrics_conc['valid_efficency_score'] = metrics_conc['VES']
|
|
|
|
|
737 |
eval_text = generate_eval_text("End evaluation")
|
738 |
yield gr.Markdown(eval_text, visible=True), gr.Image(), gr.Markdown(), gr.Markdown(), gr.Markdown(), metrics_conc, *[predictions_dict[model][columns_to_visulize] for model in model_list]
|
739 |
|
@@ -868,14 +870,15 @@ with gr.Blocks(theme='shivi/calm_seafoam', css_paths='style.css', js=js_func) as
|
|
868 |
db_path_name="db_path"
|
869 |
)
|
870 |
else:
|
|
|
871 |
metrics_df_model = us.evaluate_answer(predictions_dict[model])
|
872 |
metrics_df_model['model'] = model
|
873 |
metrics_conc = pd.concat([metrics_conc, metrics_df_model], ignore_index=True)
|
874 |
|
875 |
-
if 'valid_efficency_score' not in metrics_conc.columns
|
876 |
metrics_conc['valid_efficency_score'] = metrics_conc['VES']
|
877 |
|
878 |
-
if 'VES' not in metrics_conc.columns
|
879 |
metrics_conc['VES'] = metrics_conc['valid_efficency_score']
|
880 |
|
881 |
eval_text = generate_eval_text("End evaluation")
|
|
|
734 |
metrics_conc = target_df
|
735 |
if 'valid_efficency_score' not in metrics_conc.columns:
|
736 |
metrics_conc['valid_efficency_score'] = metrics_conc['VES']
|
737 |
+
if 'VES' not in metrics_conc.columns:
|
738 |
+
metrics_conc['VES'] = metrics_conc['valid_efficency_score']
|
739 |
eval_text = generate_eval_text("End evaluation")
|
740 |
yield gr.Markdown(eval_text, visible=True), gr.Image(), gr.Markdown(), gr.Markdown(), gr.Markdown(), metrics_conc, *[predictions_dict[model][columns_to_visulize] for model in model_list]
|
741 |
|
|
|
870 |
db_path_name="db_path"
|
871 |
)
|
872 |
else:
|
873 |
+
|
874 |
metrics_df_model = us.evaluate_answer(predictions_dict[model])
|
875 |
metrics_df_model['model'] = model
|
876 |
metrics_conc = pd.concat([metrics_conc, metrics_df_model], ignore_index=True)
|
877 |
|
878 |
+
if 'valid_efficency_score' not in metrics_conc.columns:
|
879 |
metrics_conc['valid_efficency_score'] = metrics_conc['VES']
|
880 |
|
881 |
+
if 'VES' not in metrics_conc.columns:
|
882 |
metrics_conc['VES'] = metrics_conc['valid_efficency_score']
|
883 |
|
884 |
eval_text = generate_eval_text("End evaluation")
|
utilities.py
CHANGED
@@ -185,9 +185,10 @@ def evaluate_answer(df):
|
|
185 |
target = row["target_answer"]
|
186 |
predicted = row["predicted_answer"]
|
187 |
try:
|
|
|
188 |
result = metric.run_metric(target = target, prediction = predicted)
|
189 |
except Exception as e:
|
190 |
-
result =
|
191 |
results.append(result)
|
192 |
df[metric_name] = results
|
193 |
return df
|
|
|
185 |
target = row["target_answer"]
|
186 |
predicted = row["predicted_answer"]
|
187 |
try:
|
188 |
+
predicted = eval(predicted)
|
189 |
result = metric.run_metric(target = target, prediction = predicted)
|
190 |
except Exception as e:
|
191 |
+
result = 0
|
192 |
results.append(result)
|
193 |
df[metric_name] = results
|
194 |
return df
|