Update app.py
Browse files
app.py
CHANGED
@@ -71,15 +71,11 @@ def respond(user_input):
|
|
71 |
|
72 |
# Gradio 界面
|
73 |
with gr.Blocks() as demo:
|
74 |
-
|
75 |
-
sensor_box = gr.Textbox(label="🧪 当前传感器数据", lines=6, interactive=False, value=get_sensor_data(), live=True)
|
76 |
-
question_box = gr.Textbox(label="🌿 植物问题", lines=4)
|
77 |
-
answer_box = gr.Textbox(label="🤖 回答建议", lines=8, interactive=False)
|
78 |
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
sensor_box.change(fn=show_sensor_data, inputs=None, outputs=sensor_box).every(5)
|
84 |
|
85 |
demo.launch()
|
|
|
71 |
|
72 |
# Gradio 界面
|
73 |
with gr.Blocks() as demo:
|
74 |
+
sensor_box = gr.Textbox(label="🧪 当前传感器数据", lines=6, interactive=False, value=get_sensor_data())
|
|
|
|
|
|
|
75 |
|
76 |
+
def auto_refresh():
|
77 |
+
return get_sensor_data()
|
78 |
|
79 |
+
sensor_box.change(fn=auto_refresh, inputs=None, outputs=sensor_box).every(5)
|
|
|
80 |
|
81 |
demo.launch()
|