Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -142,15 +142,15 @@ def _predict_batch(
|
|
| 142 |
merged.to_csv(output_path, index=False)
|
| 143 |
|
| 144 |
metrics_df, warnings, spearman_text = _compute_metrics(merged)
|
| 145 |
-
metrics_update = gr.
|
| 146 |
-
spearman_update = gr.
|
| 147 |
-
notes_update = gr.
|
| 148 |
value="\n".join(f"- {msg}" for msg in warnings) if warnings else "",
|
| 149 |
visible=bool(warnings),
|
| 150 |
)
|
| 151 |
|
| 152 |
return (
|
| 153 |
-
gr.
|
| 154 |
metrics_update,
|
| 155 |
spearman_update,
|
| 156 |
notes_update,
|
|
@@ -212,7 +212,7 @@ def make_interface() -> gr.Blocks:
|
|
| 212 |
batch_model = gr.File(label="Model artifact (.joblib)", file_types=[".joblib"], file_count="single")
|
| 213 |
batch_button = gr.Button("Run batch predictions", variant="primary")
|
| 214 |
batch_output = gr.File(label="Download predictions", visible=False)
|
| 215 |
-
batch_metrics = gr.
|
| 216 |
batch_spearman = gr.Textbox(label="Flag-count Spearman", interactive=False, visible=False)
|
| 217 |
batch_notes = gr.Markdown(visible=False)
|
| 218 |
|
|
|
|
| 142 |
merged.to_csv(output_path, index=False)
|
| 143 |
|
| 144 |
metrics_df, warnings, spearman_text = _compute_metrics(merged)
|
| 145 |
+
metrics_update = gr.update(value=metrics_df, visible=not metrics_df.empty)
|
| 146 |
+
spearman_update = gr.update(value=spearman_text or "", visible=spearman_text is not None)
|
| 147 |
+
notes_update = gr.update(
|
| 148 |
value="\n".join(f"- {msg}" for msg in warnings) if warnings else "",
|
| 149 |
visible=bool(warnings),
|
| 150 |
)
|
| 151 |
|
| 152 |
return (
|
| 153 |
+
gr.update(value=str(output_path), visible=True),
|
| 154 |
metrics_update,
|
| 155 |
spearman_update,
|
| 156 |
notes_update,
|
|
|
|
| 212 |
batch_model = gr.File(label="Model artifact (.joblib)", file_types=[".joblib"], file_count="single")
|
| 213 |
batch_button = gr.Button("Run batch predictions", variant="primary")
|
| 214 |
batch_output = gr.File(label="Download predictions", visible=False)
|
| 215 |
+
batch_metrics = gr.Dataframe(label="Benchmark metrics", visible=False)
|
| 216 |
batch_spearman = gr.Textbox(label="Flag-count Spearman", interactive=False, visible=False)
|
| 217 |
batch_notes = gr.Markdown(visible=False)
|
| 218 |
|