davidfertube commited on
Commit
988993d
·
1 Parent(s): 9825a11

Move demo.load to end of blocks context for proper auto-run

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -320,11 +320,9 @@ with gr.Blocks(title="Predictive Agent | LSTM-Based RUL Prediction", theme=gr.th
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,
@@ -382,5 +380,12 @@ with gr.Blocks(title="Predictive Agent | LSTM-Based RUL Prediction", theme=gr.th
382
  [Portfolio](https://davidfernandez.dev) | [GitHub](https://github.com/davidfertube/predictive-agent)
383
  """)
384
 
 
 
 
 
 
 
 
385
  if __name__ == "__main__":
386
  demo.queue().launch()
 
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,
 
380
  [Portfolio](https://davidfernandez.dev) | [GitHub](https://github.com/davidfertube/predictive-agent)
381
  """)
382
 
383
+ # Auto-run demo on page load
384
+ demo.load(
385
+ fn=run_demo,
386
+ inputs=[demo_selector],
387
+ outputs=[demo_plot, demo_report]
388
+ )
389
+
390
  if __name__ == "__main__":
391
  demo.queue().launch()