Terry Zhuo
commited on
Commit
·
c8870ae
1
Parent(s):
6ba0507
fix bug
Browse files
app.py
CHANGED
|
@@ -559,36 +559,34 @@ with main_block as demo:
|
|
| 559 |
|
| 560 |
|
| 561 |
def start_evaluation(command, jsonl_file, subset, split):
|
| 562 |
-
|
| 563 |
-
extra = subset + "_" if subset != "full" else ""
|
| 564 |
-
if jsonl_file is not None:
|
| 565 |
-
result_path = os.path.basename(jsonl_file.name).replace(".jsonl", f"_{extra}eval_results.json")
|
| 566 |
-
else:
|
| 567 |
-
result_path = None
|
| 568 |
-
|
| 569 |
-
for log in stream_logs(command, jsonl_file):
|
| 570 |
-
if jsonl_file is not None and jsonl_file.name.endswith(".jsonl"):
|
| 571 |
-
yield log, gr.update(value=result_path, label=result_path, visible=True), gr.update(visible=False)
|
| 572 |
-
else:
|
| 573 |
-
yield log, gr.update(), gr.update()
|
| 574 |
-
result_file = find_result_file()
|
| 575 |
-
if result_file:
|
| 576 |
-
return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
|
| 577 |
-
# gr.Button(visible=False)#,
|
| 578 |
-
# gr.DownloadButton(label="Download Result", value=result_file, visible=True))
|
| 579 |
-
else:
|
| 580 |
-
return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
|
| 581 |
-
# gr.Button("Run Evaluation", visible=True),
|
| 582 |
-
# gr.DownloadButton(visible=False))
|
| 583 |
-
|
| 584 |
-
try:
|
| 585 |
lock.acquire()
|
| 586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
inputs=[command_output, jsonl_file, subset, split],
|
| 588 |
-
outputs=[log_output, download_btn, submit_btn])
|
| 589 |
-
|
| 590 |
-
lock.release()
|
| 591 |
-
|
| 592 |
with gr.TabItem("🚀 Request", id=4):
|
| 593 |
gr.Markdown(SUBMISSION_TEXT_3)
|
| 594 |
|
|
|
|
| 559 |
|
| 560 |
|
| 561 |
def start_evaluation(command, jsonl_file, subset, split):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 562 |
lock.acquire()
|
| 563 |
+
try:
|
| 564 |
+
extra = subset + "_" if subset != "full" else ""
|
| 565 |
+
if jsonl_file is not None:
|
| 566 |
+
result_path = os.path.basename(jsonl_file.name).replace(".jsonl", f"_{extra}eval_results.json")
|
| 567 |
+
else:
|
| 568 |
+
result_path = None
|
| 569 |
+
|
| 570 |
+
for log in stream_logs(command, jsonl_file):
|
| 571 |
+
if jsonl_file is not None and jsonl_file.name.endswith(".jsonl"):
|
| 572 |
+
yield log, gr.update(value=result_path, label=result_path, visible=True), gr.update(visible=False)
|
| 573 |
+
else:
|
| 574 |
+
yield log, gr.update(), gr.update()
|
| 575 |
+
result_file = find_result_file()
|
| 576 |
+
if result_file:
|
| 577 |
+
return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
|
| 578 |
+
# gr.Button(visible=False)#,
|
| 579 |
+
# gr.DownloadButton(label="Download Result", value=result_file, visible=True))
|
| 580 |
+
else:
|
| 581 |
+
return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
|
| 582 |
+
# gr.Button("Run Evaluation", visible=True),
|
| 583 |
+
# gr.DownloadButton(visible=False))
|
| 584 |
+
finally:
|
| 585 |
+
lock.release()
|
| 586 |
+
submit_btn.click(start_evaluation,
|
| 587 |
inputs=[command_output, jsonl_file, subset, split],
|
| 588 |
+
outputs=[log_output, download_btn, submit_btn], concurrency_count=1)
|
| 589 |
+
|
|
|
|
|
|
|
| 590 |
with gr.TabItem("🚀 Request", id=4):
|
| 591 |
gr.Markdown(SUBMISSION_TEXT_3)
|
| 592 |
|