hysts HF staff commited on
Commit
a239782
1 Parent(s): 39e4135
Files changed (2) hide show
  1. app.py +2 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -8,6 +8,7 @@ import sys
8
  import gradio as gr
9
  import numpy as np
10
  import PIL.Image
 
11
  import torch
12
  import torchvision.transforms as T
13
  from huggingface_hub import hf_hub_download
@@ -37,6 +38,7 @@ model.eval()
37
  model.to(device)
38
 
39
 
 
40
  @torch.inference_mode()
41
  def predict(image: PIL.Image.Image) -> np.ndarray:
42
  data = transform(image)
 
8
  import gradio as gr
9
  import numpy as np
10
  import PIL.Image
11
+ import spaces
12
  import torch
13
  import torchvision.transforms as T
14
  from huggingface_hub import hf_hub_download
 
38
  model.to(device)
39
 
40
 
41
+ @spaces.GPU
42
  @torch.inference_mode()
43
  def predict(image: PIL.Image.Image) -> np.ndarray:
44
  data = transform(image)
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  numpy==1.26.4
2
  opencv-python-headless==4.9.0.80
3
  Pillow==10.3.0
 
4
  torch==2.0.1
5
  torchvision==0.15.2
 
1
  numpy==1.26.4
2
  opencv-python-headless==4.9.0.80
3
  Pillow==10.3.0
4
+ spaces==0.28.3
5
  torch==2.0.1
6
  torchvision==0.15.2