LogicGoInfotechSpaces commited on
Commit
1641332
·
1 Parent(s): c557649

Add spaces.GPU no-op handler and dependency to satisfy Spaces startup check

Browse files
Files changed (2) hide show
  1. app.py +7 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -8,6 +8,7 @@ from huggingface_hub import snapshot_download
8
  from PIL import Image
9
 
10
  from runners.simple_runner import SimpleRunner
 
11
 
12
 
13
  # -----------------------------------------------------------------------------
@@ -184,6 +185,12 @@ def build_ui() -> gr.Blocks:
184
  # Expose a top-level Gradio app for Hugging Face Spaces
185
  app = build_ui()
186
 
 
 
 
 
 
 
187
  if __name__ == "__main__":
188
  # Local run. On Spaces, the platform launches the app automatically.
189
  app.launch()
 
8
  from PIL import Image
9
 
10
  from runners.simple_runner import SimpleRunner
11
+ from spaces import GPU
12
 
13
 
14
  # -----------------------------------------------------------------------------
 
185
  # Expose a top-level Gradio app for Hugging Face Spaces
186
  app = build_ui()
187
 
188
+
189
+ @GPU()
190
+ def _warmup_gpu():
191
+ # CPU-only Space; this is a no-op to satisfy GPU startup checks
192
+ return "ok"
193
+
194
  if __name__ == "__main__":
195
  # Local run. On Spaces, the platform launches the app automatically.
196
  app.launch()
requirements.txt CHANGED
@@ -18,3 +18,4 @@ pytorch_fid==0.3.0
18
  torch
19
  torchvision
20
  clip @ git+https://github.com/openai/CLIP.git@a1d071733d7111c9c014f024669f959182114e33
 
 
18
  torch
19
  torchvision
20
  clip @ git+https://github.com/openai/CLIP.git@a1d071733d7111c9c014f024669f959182114e33
21
+ spaces>=0.28.3