Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def update_plot():
|
|
38 |
"""Function to update plot data and timestamp"""
|
39 |
data, y_min, y_max = get_time_series_data()
|
40 |
timestamp = pd.Timestamp.now().strftime("%Y-%m-%d %H:%M:%S")
|
41 |
-
|
42 |
footer_html = f"""
|
43 |
<div class="footer-content">
|
44 |
<div class="footer-left">
|
@@ -48,16 +48,9 @@ def update_plot():
|
|
48 |
</div>
|
49 |
</div>
|
50 |
"""
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
value=data,
|
55 |
-
y_min=y_min,
|
56 |
-
y_max=y_max,
|
57 |
-
y_lim=[y_min, y_max]
|
58 |
-
),
|
59 |
-
footer: footer_html
|
60 |
-
}
|
61 |
|
62 |
|
63 |
custom_css = """
|
@@ -167,10 +160,10 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as app:
|
|
167 |
</div>
|
168 |
</div>
|
169 |
""")
|
170 |
-
|
171 |
-
# Set up timer for hourly updates (
|
172 |
-
timer = gr.Timer(
|
173 |
timer.tick(update_plot, inputs=None, outputs=[line_plot, footer])
|
174 |
|
175 |
# Launch the app
|
176 |
-
app.launch()
|
|
|
38 |
"""Function to update plot data and timestamp"""
|
39 |
data, y_min, y_max = get_time_series_data()
|
40 |
timestamp = pd.Timestamp.now().strftime("%Y-%m-%d %H:%M:%S")
|
41 |
+
|
42 |
footer_html = f"""
|
43 |
<div class="footer-content">
|
44 |
<div class="footer-left">
|
|
|
48 |
</div>
|
49 |
</div>
|
50 |
"""
|
51 |
+
|
52 |
+
# Return values directly instead of using .update()
|
53 |
+
return data, footer_html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
custom_css = """
|
|
|
160 |
</div>
|
161 |
</div>
|
162 |
""")
|
163 |
+
|
164 |
+
# Set up timer for half-hourly updates (1800 seconds)
|
165 |
+
timer = gr.Timer(60)
|
166 |
timer.tick(update_plot, inputs=None, outputs=[line_plot, footer])
|
167 |
|
168 |
# Launch the app
|
169 |
+
app.launch()
|