Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -380,6 +380,15 @@ def app():
|
|
| 380 |
|
| 381 |
yield ("π‘ Processing...", output_log + eval_report_buffer, eval_report_buffer, gr.Button(visible=False))
|
| 382 |
await asyncio.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
|
| 384 |
final_output = output_log
|
| 385 |
if eval_report_buffer:
|
|
@@ -400,21 +409,26 @@ def app():
|
|
| 400 |
[topic, samples, model_name, task_type],
|
| 401 |
[status, output, eval_report_storage, copy_btn]
|
| 402 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
copy_btn.click(
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
)
|
| 418 |
|
| 419 |
return demo
|
| 420 |
|
|
|
|
| 380 |
|
| 381 |
yield ("π‘ Processing...", output_log + eval_report_buffer, eval_report_buffer, gr.Button(visible=False))
|
| 382 |
await asyncio.sleep(0.1)
|
| 383 |
+
eval_report_buffer = ""
|
| 384 |
+
if "π **EVALUATION REPORT**" in full_log or "EVALUATION" in full_log:
|
| 385 |
+
parts = full_log.split("π")
|
| 386 |
+
if len(parts) > 1:
|
| 387 |
+
eval_report_buffer = "π" + parts[-1]
|
| 388 |
+
else:
|
| 389 |
+
# Fallback - get last 2000 characters as eval report
|
| 390 |
+
eval_report_buffer = full_log[-2000:]
|
| 391 |
+
|
| 392 |
|
| 393 |
final_output = output_log
|
| 394 |
if eval_report_buffer:
|
|
|
|
| 409 |
[topic, samples, model_name, task_type],
|
| 410 |
[status, output, eval_report_storage, copy_btn]
|
| 411 |
)
|
| 412 |
+
def copy_report(report_text):
|
| 413 |
+
if report_text and report_text.strip():
|
| 414 |
+
return report_text
|
| 415 |
+
return ""
|
| 416 |
+
|
| 417 |
copy_btn.click(
|
| 418 |
+
copy_report,
|
| 419 |
+
inputs=[eval_report_storage],
|
| 420 |
+
outputs=[],
|
| 421 |
+
js="""
|
| 422 |
+
(text) => {
|
| 423 |
+
if (text && text.trim().length > 0) {
|
| 424 |
+
navigator.clipboard.writeText(text);
|
| 425 |
+
alert('β
Evaluation report copied to clipboard!');
|
| 426 |
+
} else {
|
| 427 |
+
alert('β οΈ No evaluation report available yet!');
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
"""
|
| 431 |
+
)
|
| 432 |
|
| 433 |
return demo
|
| 434 |
|