Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,9 +22,10 @@ import io
|
|
22 |
from io import BytesIO
|
23 |
from botocore.exceptions import NoCredentialsError, PartialCredentialsError
|
24 |
|
|
|
|
|
25 |
app = FastAPI()
|
26 |
|
27 |
-
torch.cuda.empty_cache()
|
28 |
|
29 |
subprocess.run(shlex.split('pip install wheel/torchmcubes-0.1.0-cp310-cp310-linux_x86_64.whl'))
|
30 |
|
@@ -168,6 +169,7 @@ def preprocess(input_image, do_remove_background, foreground_ratio):
|
|
168 |
image = resize_foreground(image, foreground_ratio)
|
169 |
image = fill_background(image)
|
170 |
print("do_remove_back")
|
|
|
171 |
else:
|
172 |
image = input_image
|
173 |
if image.mode == "RGBA":
|
@@ -176,6 +178,7 @@ def preprocess(input_image, do_remove_background, foreground_ratio):
|
|
176 |
|
177 |
# @spaces.GPU
|
178 |
def generate(image, mc_resolution, formats=["obj", "glb"]):
|
|
|
179 |
scene_codes = model(image, device=device)
|
180 |
mesh = model.extract_mesh(scene_codes, resolution=mc_resolution)[0]
|
181 |
mesh = to_gradio_3d_orientation(mesh)
|
|
|
22 |
from io import BytesIO
|
23 |
from botocore.exceptions import NoCredentialsError, PartialCredentialsError
|
24 |
|
25 |
+
torch.cuda.empty_cache()
|
26 |
+
|
27 |
app = FastAPI()
|
28 |
|
|
|
29 |
|
30 |
subprocess.run(shlex.split('pip install wheel/torchmcubes-0.1.0-cp310-cp310-linux_x86_64.whl'))
|
31 |
|
|
|
169 |
image = resize_foreground(image, foreground_ratio)
|
170 |
image = fill_background(image)
|
171 |
print("do_remove_back")
|
172 |
+
torch.cuda.empty_cache()
|
173 |
else:
|
174 |
image = input_image
|
175 |
if image.mode == "RGBA":
|
|
|
178 |
|
179 |
# @spaces.GPU
|
180 |
def generate(image, mc_resolution, formats=["obj", "glb"]):
|
181 |
+
torch.cuda.empty_cache()
|
182 |
scene_codes = model(image, device=device)
|
183 |
mesh = model.extract_mesh(scene_codes, resolution=mc_resolution)[0]
|
184 |
mesh = to_gradio_3d_orientation(mesh)
|