CreativeEngineer commited on
Commit
4da69c3
·
1 Parent(s): 4daeb52

Replace timer polling with manual Refresh Log

Browse files
Files changed (1) hide show
  1. app.py +7 -5
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
- return "\n".join(training_state["log"][-400:]) if training_state["log"] else ""
 
 
 
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], queue=False)
796
-
797
- gr.Timer(1.0).tick(poll_log, outputs=[output_box], queue=False)
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)