Spaces:
Runtime error
Runtime error
Ziyou Li
commited on
Commit
·
425589d
1
Parent(s):
8626c10
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def get_row():
|
|
38 |
vis = json_response_smhi["timeSeries"][0]["parameters"][9]["values"][0] # Visibility
|
39 |
|
40 |
# Use current time
|
41 |
-
referenceTime = time.time()
|
42 |
|
43 |
row ={"referenceTime": referenceTime,
|
44 |
"temperature": t,
|
@@ -82,13 +82,20 @@ with gr.Blocks() as demo:
|
|
82 |
|
83 |
with gr.Row():
|
84 |
btn_sub = gr.Button(value="Submit")
|
|
|
|
|
|
|
|
|
85 |
|
86 |
btn_sub.click(infer, inputs = inputs, outputs = outputs)
|
|
|
87 |
|
88 |
#examples = gr.Examples(fn = infer, examples=[get_row()],inputs=inputs,outputs=outputs ,cache_examples=True)
|
89 |
examples = gr.Examples(fn = infer, examples=[get_row()] ,inputs=inputs, outputs=outputs, cache_examples=False)
|
90 |
|
|
|
91 |
demo.load(get_row, inputs = None, outputs = [inputs], every=10)
|
|
|
92 |
|
93 |
|
94 |
|
|
|
38 |
vis = json_response_smhi["timeSeries"][0]["parameters"][9]["values"][0] # Visibility
|
39 |
|
40 |
# Use current time
|
41 |
+
referenceTime = int(time.time())
|
42 |
|
43 |
row ={"referenceTime": referenceTime,
|
44 |
"temperature": t,
|
|
|
82 |
|
83 |
with gr.Row():
|
84 |
btn_sub = gr.Button(value="Submit")
|
85 |
+
with gr.Row():
|
86 |
+
btn_ref = gr.Button(value="Get real-time data")
|
87 |
+
|
88 |
+
|
89 |
|
90 |
btn_sub.click(infer, inputs = inputs, outputs = outputs)
|
91 |
+
btn_sub.ref(get_row, inputs = None, outputs = inputs)
|
92 |
|
93 |
#examples = gr.Examples(fn = infer, examples=[get_row()],inputs=inputs,outputs=outputs ,cache_examples=True)
|
94 |
examples = gr.Examples(fn = infer, examples=[get_row()] ,inputs=inputs, outputs=outputs, cache_examples=False)
|
95 |
|
96 |
+
# demo.load(get_row, inputs = None, outputs = [inputs], every=10)
|
97 |
demo.load(get_row, inputs = None, outputs = [inputs], every=10)
|
98 |
+
|
99 |
|
100 |
|
101 |
|