Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,7 @@ def prep_for_rayst3r(img,depth_dict,mask):
|
|
| 109 |
# save image
|
| 110 |
save_tensor_as_png(torch.from_numpy(img), os.path.join(input_dir, "rgb.png"))
|
| 111 |
|
| 112 |
-
@GPU(duration =
|
| 113 |
def rayst3r_to_glb(img,depth_dict,mask,max_total_points=10e6,rotated=False):
|
| 114 |
prep_for_rayst3r(img,depth_dict,mask)
|
| 115 |
|
|
@@ -160,14 +160,14 @@ def input_to_glb(outdir,img,depth_dict,mask,rotated=False):
|
|
| 160 |
scene.export(outfile)
|
| 161 |
return outfile
|
| 162 |
|
| 163 |
-
@GPU(duration =
|
| 164 |
def depth_moge(input_img):
|
| 165 |
|
| 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)
|
| 168 |
return output
|
| 169 |
|
| 170 |
-
@GPU(duration =
|
| 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(duration =
|
| 190 |
def process_image(input_img):
|
| 191 |
|
| 192 |
rotated = False
|
|
|
|
| 109 |
# save image
|
| 110 |
save_tensor_as_png(torch.from_numpy(img), os.path.join(input_dir, "rgb.png"))
|
| 111 |
|
| 112 |
+
@GPU(duration = 110)
|
| 113 |
def rayst3r_to_glb(img,depth_dict,mask,max_total_points=10e6,rotated=False):
|
| 114 |
prep_for_rayst3r(img,depth_dict,mask)
|
| 115 |
|
|
|
|
| 160 |
scene.export(outfile)
|
| 161 |
return outfile
|
| 162 |
|
| 163 |
+
# @GPU(duration = 50)
|
| 164 |
def depth_moge(input_img):
|
| 165 |
|
| 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)
|
| 168 |
return output
|
| 169 |
|
| 170 |
+
# @GPU(duration = 20)
|
| 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 = 60)
|
| 190 |
def process_image(input_img):
|
| 191 |
|
| 192 |
rotated = False
|