nihaluser commited on
Commit
927e6bd
·
verified ·
1 Parent(s): 67d9b86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -52,13 +52,17 @@ def predict(data: MachineData):
52
  )
53
 
54
 
55
- # Required dummy decorator so ZeroGPU allows the Space to boot without consuming GPU quota
56
  @spaces.GPU
57
  def warmup():
58
- return "OK"
59
 
60
 
61
  with gr.Blocks() as demo:
62
  gr.Markdown("### Aegis CNC Predictive Maintenance API is Running\nUse `POST /predict` from the frontend.")
 
 
 
63
 
64
- app = gr.mount_gradio_app(api, demo, path="/")
 
 
52
  )
53
 
54
 
55
+ # Wired to a Gradio button so ZeroGPU detects @spaces.GPU during demo.launch()
56
  @spaces.GPU
57
  def warmup():
58
+ return "ZeroGPU Hook Active"
59
 
60
 
61
  with gr.Blocks() as demo:
62
  gr.Markdown("### Aegis CNC Predictive Maintenance API is Running\nUse `POST /predict` from the frontend.")
63
+ btn = gr.Button("Check ZeroGPU Hook")
64
+ out = gr.Textbox(label="Status")
65
+ btn.click(fn=warmup, outputs=out)
66
 
67
+ # demo.launch(app=api) triggers ZeroGPU's startup hook AND serves your FastAPI routes (/predict, /health)
68
+ demo.launch(app=api)