makiling commited on
Commit
1bcf548
·
verified ·
1 Parent(s): 91db4c0

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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.DataFrame.update(value=metrics_df, visible=not metrics_df.empty)
146
- spearman_update = gr.Textbox.update(value=spearman_text or "", visible=spearman_text is not None)
147
- notes_update = gr.Markdown.update(
148
  value="\n".join(f"- {msg}" for msg in warnings) if warnings else "",
149
  visible=bool(warnings),
150
  )
151
 
152
  return (
153
- gr.File.update(value=str(output_path), visible=True),
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.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
 
 
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