vishanth11 commited on
Commit
eb16fd7
·
1 Parent(s): 0bb91ff

Register ZeroGPU worker for Space startup

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -23,6 +23,22 @@ except Exception:
23
 
24
  from dashboard_api import app as fastapi_app
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  with gr.Blocks(title="AI Traffic Adaptation System") as demo:
28
  gr.HTML(
 
23
 
24
  from dashboard_api import app as fastapi_app
25
 
26
+ try:
27
+ import spaces
28
+ except ImportError:
29
+ class spaces:
30
+ @staticmethod
31
+ def GPU(fn=None, duration=120):
32
+ if fn is None:
33
+ return lambda function: function
34
+ return fn
35
+
36
+
37
+ @spaces.GPU(duration=120)
38
+ def zero_gpu_pipeline_worker(value: str = "") -> str:
39
+ """Register the Space's ZeroGPU worker with Hugging Face's supervisor."""
40
+ return value
41
+
42
 
43
  with gr.Blocks(title="AI Traffic Adaptation System") as demo:
44
  gr.HTML(