Update app.py
Browse files
app.py
CHANGED
@@ -566,29 +566,28 @@ with main_block as demo:
|
|
566 |
|
567 |
def start_evaluation(command, jsonl_file, subset, split):
|
568 |
lock.acquire()
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
|
|
|
|
|
|
|
|
|
|
573 |
else:
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
else:
|
587 |
-
return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
|
588 |
-
# gr.Button("Run Evaluation", visible=True),
|
589 |
-
# gr.DownloadButton(visible=False))
|
590 |
-
finally:
|
591 |
-
lock.release()
|
592 |
submit_btn.click(start_evaluation,
|
593 |
inputs=[command_output, jsonl_file, subset, split],
|
594 |
outputs=[log_output, download_btn, submit_btn])
|
|
|
566 |
|
567 |
def start_evaluation(command, jsonl_file, subset, split):
|
568 |
lock.acquire()
|
569 |
+
extra = subset + "_" if subset != "full" else ""
|
570 |
+
if jsonl_file is not None:
|
571 |
+
result_path = os.path.basename(jsonl_file.name).replace(".jsonl", f"_{extra}eval_results.json")
|
572 |
+
else:
|
573 |
+
result_path = None
|
574 |
+
|
575 |
+
for log in stream_logs(command, jsonl_file):
|
576 |
+
if jsonl_file is not None and jsonl_file.name.endswith(".jsonl"):
|
577 |
+
yield log, gr.update(value=result_path, label=result_path, visible=True), gr.update(visible=False)
|
578 |
else:
|
579 |
+
yield log, gr.update(), gr.update()
|
580 |
+
lock.release()
|
581 |
+
result_file = find_result_file()
|
582 |
+
if result_file:
|
583 |
+
return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
|
584 |
+
# gr.Button(visible=False)#,
|
585 |
+
# gr.DownloadButton(label="Download Result", value=result_file, visible=True))
|
586 |
+
else:
|
587 |
+
return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
|
588 |
+
# gr.Button("Run Evaluation", visible=True),
|
589 |
+
# gr.DownloadButton(visible=False))
|
590 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
submit_btn.click(start_evaluation,
|
592 |
inputs=[command_output, jsonl_file, subset, split],
|
593 |
outputs=[log_output, download_btn, submit_btn])
|