Stanislaw Szymanowicz commited on
Commit
9f405ed
1 Parent(s): 2e233be

Run on spaces gpu

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import numpy as np
5
  import os
6
  from omegaconf import OmegaConf
7
  from PIL import Image
 
8
 
9
  from utils.app_utils import (
10
  remove_background,
@@ -33,7 +34,6 @@ def main():
33
 
34
  if torch.cuda.is_available():
35
  device = "cuda:0"
36
- torch.cuda.set_device(device)
37
  print("Found cuda")
38
  else:
39
  device = "cpu"
@@ -77,6 +77,7 @@ def main():
77
 
78
  ply_out_path = f'./mesh.ply'
79
 
 
80
  def reconstruct_and_export(image):
81
  """
82
  Passes image through model, outputs reconstruction in form of a dict of tensors.
 
5
  import os
6
  from omegaconf import OmegaConf
7
  from PIL import Image
8
+ import spaces
9
 
10
  from utils.app_utils import (
11
  remove_background,
 
34
 
35
  if torch.cuda.is_available():
36
  device = "cuda:0"
 
37
  print("Found cuda")
38
  else:
39
  device = "cpu"
 
77
 
78
  ply_out_path = f'./mesh.ply'
79
 
80
+ @spaces.GPU()
81
  def reconstruct_and_export(image):
82
  """
83
  Passes image through model, outputs reconstruction in form of a dict of tensors.
requirements.txt CHANGED
@@ -8,4 +8,5 @@ moviepy
8
  markupsafe==2.0.1
9
  gradio==4.25.0
10
  rembg
 
11
  # git+https://github.com/graphdeco-inria/diff-gaussian-rasterization
 
8
  markupsafe==2.0.1
9
  gradio==4.25.0
10
  rembg
11
+ spaces
12
  # git+https://github.com/graphdeco-inria/diff-gaussian-rasterization