Ribakoo commited on
Commit
46bc6fd
·
1 Parent(s): 1a616a5

Support Hugging Face ZeroGPU with spaces.GPU decorator

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -33,6 +33,15 @@ STORAGE_DIR = BASE_DIR / "storage"
33
  STORAGE_DIR.mkdir(exist_ok=True)
34
 
35
 
 
 
 
 
 
 
 
 
 
36
  def process_image(input_img, mode, preset, scale, denoise):
37
  if input_img is None:
38
  return None, None, None, "Please upload an image first."
 
33
  STORAGE_DIR.mkdir(exist_ok=True)
34
 
35
 
36
+ try:
37
+ import spaces
38
+ gpu_decorator = spaces.GPU
39
+ except (ImportError, Exception):
40
+ def gpu_decorator(fn):
41
+ return fn
42
+
43
+
44
+ @gpu_decorator
45
  def process_image(input_img, mode, preset, scale, denoise):
46
  if input_img is None:
47
  return None, None, None, "Please upload an image first."