davidfertube commited on
Commit
9825a11
·
1 Parent(s): 832ace0

Pre-compute demo for instant display on load

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -320,9 +320,11 @@ with gr.Blocks(title="Predictive Agent | LSTM-Based RUL Prediction", theme=gr.th
320
  """)
321
 
322
  with gr.Column(scale=2):
323
- demo_plot = gr.Plot(label="Health Trend Analysis")
 
 
324
 
325
- demo_report = gr.Markdown(label="Maintenance Report")
326
 
327
  demo_btn.click(
328
  fn=run_demo,
@@ -331,13 +333,6 @@ with gr.Blocks(title="Predictive Agent | LSTM-Based RUL Prediction", theme=gr.th
331
  api_name="run_demo"
332
  )
333
 
334
- # Auto-run demo on page load
335
- demo.load(
336
- fn=run_demo,
337
- inputs=[demo_selector],
338
- outputs=[demo_plot, demo_report]
339
- )
340
-
341
  # Upload tab second
342
  with gr.TabItem("Upload Your Data", id=1):
343
  gr.Markdown("""
 
320
  """)
321
 
322
  with gr.Column(scale=2):
323
+ # Pre-compute demo result for instant display
324
+ initial_plot, initial_report = run_demo("Degrading Turbine (Urgent)")
325
+ demo_plot = gr.Plot(value=initial_plot, label="Health Trend Analysis")
326
 
327
+ demo_report = gr.Markdown(value=initial_report, label="Maintenance Report")
328
 
329
  demo_btn.click(
330
  fn=run_demo,
 
333
  api_name="run_demo"
334
  )
335
 
 
 
 
 
 
 
 
336
  # Upload tab second
337
  with gr.TabItem("Upload Your Data", id=1):
338
  gr.Markdown("""