Spaces:
Sleeping
Sleeping
Rowan Martnishn
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -247,29 +247,30 @@ body, .gradio-container {
|
|
247 |
|
248 |
|
249 |
with gr.Blocks(css=custom_css) as demo:
|
250 |
-
# Initialize
|
251 |
-
|
252 |
|
253 |
-
# Define the refresh function
|
254 |
def refresh_html():
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
262 |
|
263 |
-
# Use the Timer component to
|
264 |
-
timer = gr.Timer(
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
|
271 |
# Initial call to set the HTML content when the page loads
|
272 |
-
demo.load(refresh_html,
|
273 |
|
274 |
# Launch the demo
|
275 |
demo.launch()
|
|
|
247 |
|
248 |
|
249 |
with gr.Blocks(css=custom_css) as demo:
|
250 |
+
# Initialize the HTML output with a default message
|
251 |
+
html_output = gr.HTML("Processing data...")
|
252 |
|
253 |
+
# Define the refresh function
|
254 |
def refresh_html():
|
255 |
+
if prediction_plot_base64:
|
256 |
+
return (
|
257 |
+
f'<img src="data:image/png;base64,{prediction_plot_base64}" '
|
258 |
+
'alt="Prediction Plot" '
|
259 |
+
'style="width: 100vw; height: 100vh; object-fit: contain;">'
|
260 |
+
)
|
261 |
+
else:
|
262 |
+
return "Processing data..."
|
263 |
|
264 |
+
# Use the Timer component according to the documentation
|
265 |
+
timer = gr.Timer(3600, refresh_html, [], html_output)
|
266 |
+
|
267 |
+
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
|
272 |
# Initial call to set the HTML content when the page loads
|
273 |
+
demo.load(refresh_html, [], html_output)
|
274 |
|
275 |
# Launch the demo
|
276 |
demo.launch()
|