Rowan Martnishn commited on
Commit
3d94b93
·
verified ·
1 Parent(s): 1b05bbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -275,10 +275,27 @@ body, .gradio-container {
275
  }
276
  """
277
 
 
 
 
 
 
 
 
 
278
  with gr.Blocks(css=custom_css) as demo:
279
- gr.HTML(value=html_content)
280
 
 
 
 
 
 
 
 
 
 
281
 
282
- print("Data refreshed at:", datetime.datetime.now())
283
 
284
- demo.launch()
 
275
  }
276
  """
277
 
278
+ # with gr.Blocks(css=custom_css) as demo:
279
+ # gr.HTML(value=html_content)
280
+
281
+
282
+ # print("Data refreshed at:", datetime.datetime.now())
283
+
284
+ # demo.launch()
285
+
286
  with gr.Blocks(css=custom_css) as demo:
287
+ html_output = gr.HTML()
288
 
289
+ def refresh_html():
290
+ if prediction_plot_base64:
291
+ return (
292
+ f'<img src="data:image/png;base64,{prediction_plot_base64}" '
293
+ 'alt="Prediction Plot" '
294
+ 'style="width: 100vw; height: 100vh; object-fit: contain;">'
295
+ )
296
+ else:
297
+ return "Processing data..."
298
 
299
+ gr.Timer(refresh_html, every=10, every_units="seconds", show_progress=False, fn_kwargs={}, outputs=html_output)
300
 
301
+ demo.launch()