bartduis commited on
Commit
69d2930
·
verified ·
1 Parent(s): 0bc7fd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -16,7 +16,7 @@ from eval_wrapper.eval import EvalWrapper, eval_scene
16
 
17
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
18
 
19
- @GPU
20
  def dummy_warmup():
21
  import torch
22
  if torch.cuda.is_available():
@@ -98,7 +98,7 @@ def prep_for_rayst3r(img,depth_dict,mask):
98
  # save image
99
  save_tensor_as_png(torch.from_numpy(img), os.path.join(input_dir, "rgb.png"))
100
 
101
- @GPU
102
  def rayst3r_to_glb(img,depth_dict,mask,max_total_points=10e6,rotated=False):
103
  prep_for_rayst3r(img,depth_dict,mask)
104
 
@@ -159,15 +159,15 @@ def input_to_glb(outdir,img,depth_dict,mask,rotated=False):
159
  scene.export(outfile)
160
  return outfile
161
 
162
- @GPU
163
  def depth_moge(input_img):
164
  moge_model = MoGeModel.from_pretrained("Ruicheng/moge-vitl")
165
  moge_model.to(device)
166
- input_img_torch = torch.tensor(input_img / 255, dtype=torch.float32, device='cuda').permute(2, 0, 1)
167
  output = moge_model.infer(input_img_torch).cpu()
168
  return output
169
 
170
- @GPU
171
  def mask_rembg(input_img):
172
  #masked_img = rembg.remove(input_img,)
173
  output_img = rembg.remove(input_img, alpha_matting=False, post_process_mask=True)
@@ -186,7 +186,7 @@ def mask_rembg(input_img):
186
  rgb = output_np[:,:,:3]
187
  return mask, rgb
188
 
189
- @GPU
190
  def process_image(input_img):
191
  # resize the input image
192
  rotated = False
 
16
 
17
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
18
 
19
+ @GPU(duration = 180)
20
  def dummy_warmup():
21
  import torch
22
  if torch.cuda.is_available():
 
98
  # save image
99
  save_tensor_as_png(torch.from_numpy(img), os.path.join(input_dir, "rgb.png"))
100
 
101
+ @GPU(duration = 180)
102
  def rayst3r_to_glb(img,depth_dict,mask,max_total_points=10e6,rotated=False):
103
  prep_for_rayst3r(img,depth_dict,mask)
104
 
 
159
  scene.export(outfile)
160
  return outfile
161
 
162
+ @GPU(duration = 180)
163
  def depth_moge(input_img):
164
  moge_model = MoGeModel.from_pretrained("Ruicheng/moge-vitl")
165
  moge_model.to(device)
166
+ input_img_torch = torch.tensor(input_img / 255, dtype=torch.float32, device=device).permute(2, 0, 1)
167
  output = moge_model.infer(input_img_torch).cpu()
168
  return output
169
 
170
+ @GPU(duration = 180)
171
  def mask_rembg(input_img):
172
  #masked_img = rembg.remove(input_img,)
173
  output_img = rembg.remove(input_img, alpha_matting=False, post_process_mask=True)
 
186
  rgb = output_np[:,:,:3]
187
  return mask, rgb
188
 
189
+ @GPU(duration = 180)
190
  def process_image(input_img):
191
  # resize the input image
192
  rotated = False