singam96 commited on
Commit
c2bb3a6
·
verified ·
1 Parent(s): a791b8c

ZeroGPU: declare GPU function + space requirements

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import gradio as gr
5
  import numpy as np
6
  import onnxruntime as ort
 
7
  from PIL import Image
8
 
9
  from inference_utils import build_grid, pil_to_np, resize_pad
@@ -15,6 +16,7 @@ IMAGE_SIZE = 512
15
  _sess = ort.InferenceSession(MODEL_PATH, providers=["CPUExecutionProvider"])
16
 
17
 
 
18
  def decompose(image: Image.Image) -> Image.Image:
19
  img_rgb = resize_pad(image.convert("RGB"), IMAGE_SIZE)
20
  x = pil_to_np(img_rgb).astype(np.float32)
 
4
  import gradio as gr
5
  import numpy as np
6
  import onnxruntime as ort
7
+ import spaces
8
  from PIL import Image
9
 
10
  from inference_utils import build_grid, pil_to_np, resize_pad
 
16
  _sess = ort.InferenceSession(MODEL_PATH, providers=["CPUExecutionProvider"])
17
 
18
 
19
+ @spaces.GPU(duration=60)
20
  def decompose(image: Image.Image) -> Image.Image:
21
  img_rgb = resize_pad(image.convert("RGB"), IMAGE_SIZE)
22
  x = pil_to_np(img_rgb).astype(np.float32)