Commit
·
4da69c3
1
Parent(s):
4daeb52
Replace timer polling with manual Refresh Log
Browse files
app.py
CHANGED
|
@@ -784,17 +784,19 @@ with gr.Blocks(title="VLIW Optimizer") as demo:
|
|
| 784 |
|
| 785 |
def poll_log():
|
| 786 |
with state_lock:
|
| 787 |
-
|
|
|
|
|
|
|
|
|
|
| 788 |
|
| 789 |
start_btn.click(
|
| 790 |
start_training,
|
| 791 |
[model_dropdown, chunk_steps_slider, max_total_steps_slider, max_minutes_number, auto_continue_checkbox],
|
| 792 |
[output_box],
|
| 793 |
-
queue=False,
|
| 794 |
)
|
| 795 |
-
stop_btn.click(stop_training, [], [output_box]
|
| 796 |
-
|
| 797 |
-
|
| 798 |
|
| 799 |
if __name__ == "__main__":
|
| 800 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 784 |
|
| 785 |
def poll_log():
|
| 786 |
with state_lock:
|
| 787 |
+
if not training_state["log"]:
|
| 788 |
+
return ""
|
| 789 |
+
lines = training_state["log"][-200:]
|
| 790 |
+
return "\n".join(line[:400] for line in lines)
|
| 791 |
|
| 792 |
start_btn.click(
|
| 793 |
start_training,
|
| 794 |
[model_dropdown, chunk_steps_slider, max_total_steps_slider, max_minutes_number, auto_continue_checkbox],
|
| 795 |
[output_box],
|
|
|
|
| 796 |
)
|
| 797 |
+
stop_btn.click(stop_training, [], [output_box])
|
| 798 |
+
refresh_btn = gr.Button("Refresh Log")
|
| 799 |
+
refresh_btn.click(poll_log, outputs=[output_box])
|
| 800 |
|
| 801 |
if __name__ == "__main__":
|
| 802 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|