Spaces:
Sleeping
Sleeping
Rowan Martnishn
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -292,30 +292,26 @@ body, .gradio-container {
|
|
292 |
"""
|
293 |
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
298 |
if prediction_plot_base64:
|
299 |
-
|
300 |
f'<img src="data:image/png;base64,{prediction_plot_base64}" '
|
301 |
'alt="Prediction Plot" '
|
302 |
'style="width: 100vw; height: 100vh; object-fit: contain;">'
|
303 |
)
|
304 |
else:
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
# Wait 10 seconds
|
311 |
-
time.sleep(10)
|
312 |
-
|
313 |
-
with gr.Blocks(css=custom_css) as demo:
|
314 |
-
# Initialize the HTML output with a default message
|
315 |
-
html_output = gr.HTML("Processing data...")
|
316 |
|
317 |
-
#
|
318 |
-
demo.load(
|
319 |
|
320 |
# Launch the demo
|
321 |
demo.launch()
|
|
|
292 |
"""
|
293 |
|
294 |
|
295 |
+
with gr.Blocks(css=custom_css) as demo:
|
296 |
+
# Initialize the HTML output with a default message
|
297 |
+
html_output = gr.HTML("Processing data...")
|
298 |
+
|
299 |
+
# Define the refresh function
|
300 |
+
def refresh_html():
|
301 |
if prediction_plot_base64:
|
302 |
+
return (
|
303 |
f'<img src="data:image/png;base64,{prediction_plot_base64}" '
|
304 |
'alt="Prediction Plot" '
|
305 |
'style="width: 100vw; height: 100vh; object-fit: contain;">'
|
306 |
)
|
307 |
else:
|
308 |
+
return "Processing data..."
|
309 |
+
|
310 |
+
# Use the Timer component according to the documentation
|
311 |
+
timer = gr.Timer(10, refresh_html, [], html_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
+
# Initial call to set the HTML content when the page loads
|
314 |
+
demo.load(refresh_html, [], html_output)
|
315 |
|
316 |
# Launch the demo
|
317 |
demo.launch()
|