bartduis commited on
Commit
74f7955
·
verified ·
1 Parent(s): c9e32c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -17,7 +17,7 @@ import gradio as gr
17
  # from moge.model.v1 import MoGeModel
18
  # from utils.geometry import compute_pointmap
19
  # import os, shutil
20
- # import cv2
21
  # from huggingface_hub import hf_hub_download
22
  # from PIL import Image
23
  # import matplotlib.pyplot as plt
@@ -196,9 +196,22 @@ import gradio as gr
196
  # rgb = output_np[:,:,:3]
197
  # return mask, rgb
198
 
 
199
  def process_image(input_img):
 
 
 
 
 
 
 
 
 
 
 
 
200
  return input_img, input_img
201
- # @GPU(duration = 180)
202
  # def process_image(input_img):
203
  # # resize the input image
204
  # rotated = False
 
17
  # from moge.model.v1 import MoGeModel
18
  # from utils.geometry import compute_pointmap
19
  # import os, shutil
20
+ import cv2
21
  # from huggingface_hub import hf_hub_download
22
  # from PIL import Image
23
  # import matplotlib.pyplot as plt
 
196
  # rgb = output_np[:,:,:3]
197
  # return mask, rgb
198
 
199
+ @GPU(duration = 180)
200
  def process_image(input_img):
201
+
202
+ rotated = False
203
+ if input_img.shape[0] > input_img.shape[1]:
204
+ input_img = cv2.rotate(input_img, cv2.ROTATE_90_COUNTERCLOCKWISE)
205
+ rotated = True
206
+ input_img = cv2.resize(input_img, (640, 480))
207
+ mask, rgb = mask_rembg(input_img)
208
+ depth_dict = depth_moge(input_img)
209
+ if os.path.exists(outdir):
210
+ shutil.rmtree(outdir)
211
+ os.makedirs(outdir)
212
+
213
  return input_img, input_img
214
+
215
  # def process_image(input_img):
216
  # # resize the input image
217
  # rotated = False