bapi143 commited on
Commit
2f4b890
·
1 Parent(s): 8d356f8

Add @spaces.GPU handler for Hugging Face ZeroGPU runtime verification

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -15,6 +15,17 @@ sys.path.insert(0, str(Path(__file__).parent))
15
  import gradio as gr
16
  from backend.main import app as backend_app
17
 
 
 
 
 
 
 
 
 
 
 
 
18
  # Web Landing Page for visitors opening the Space in browser
19
  with gr.Blocks(title="🌾 CropAI Agronomic Cloud") as demo:
20
  gr.Markdown("# 🌾 CropAI: Autonomous Plant Pathology & Advisory Ecosystem")
 
15
  import gradio as gr
16
  from backend.main import app as backend_app
17
 
18
+ # ZeroGPU Startup Detection Handler
19
+ try:
20
+ import spaces
21
+ @spaces.GPU
22
+ def zero_gpu_pipeline(x: str = "") -> str:
23
+ """Keeps Hugging Face ZeroGPU environment verified and active."""
24
+ return f"CropAI ZeroGPU Pipeline Active: {x}"
25
+ except Exception:
26
+ def zero_gpu_pipeline(x: str = "") -> str:
27
+ return f"CropAI CPU Pipeline Active: {x}"
28
+
29
  # Web Landing Page for visitors opening the Space in browser
30
  with gr.Blocks(title="🌾 CropAI Agronomic Cloud") as demo:
31
  gr.Markdown("# 🌾 CropAI: Autonomous Plant Pathology & Advisory Ecosystem")