linx5o commited on
Commit
96e746e
·
1 Parent(s): 31206fe
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -62,10 +62,6 @@ def get_data(serial):
62
 
63
  return "Request sent. Waiting for response..."
64
 
65
- @gr.render(inputs=[])
66
- def display_data():
67
- """Function to return the latest received data dynamically."""
68
- return latest_data["status"], latest_data["bed_temperature"], latest_data["nozzle_temperature"], latest_data["update_time"]
69
 
70
  # Gradio UI
71
  with gr.Blocks() as blocks:
@@ -79,6 +75,11 @@ with gr.Blocks() as blocks:
79
 
80
  send_button.click(fn=get_data, inputs=[serial], outputs=[])
81
 
 
 
 
 
 
82
  # Dynamic rendering using @gr.render
83
  display_data() >> [status_text, bed_temp_text, nozzle_temp_text, update_time_text]
84
 
 
62
 
63
  return "Request sent. Waiting for response..."
64
 
 
 
 
 
65
 
66
  # Gradio UI
67
  with gr.Blocks() as blocks:
 
75
 
76
  send_button.click(fn=get_data, inputs=[serial], outputs=[])
77
 
78
+ @gr.render(inputs=[])
79
+ def display_data():
80
+ """Function to return the latest received data dynamically."""
81
+ return latest_data["status"], latest_data["bed_temperature"], latest_data["nozzle_temperature"], latest_data["update_time"]
82
+
83
  # Dynamic rendering using @gr.render
84
  display_data() >> [status_text, bed_temp_text, nozzle_temp_text, update_time_text]
85