Spaces:
Runtime error
Runtime error
Upload gradio_app.py
Browse files- gradio_app.py +18 -13
gradio_app.py
CHANGED
|
@@ -31,17 +31,21 @@ from hy3dgen.shapegen.utils import logger
|
|
| 31 |
|
| 32 |
MAX_SEED = 1e7
|
| 33 |
|
| 34 |
-
if True:
|
| 35 |
-
import os
|
| 36 |
-
import spaces
|
| 37 |
-
import subprocess
|
| 38 |
-
import sys
|
| 39 |
-
import shlex
|
| 40 |
-
print("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
|
| 41 |
-
os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
|
| 42 |
-
print('install custom')
|
| 43 |
-
subprocess.run(shlex.split("pip install custom_rasterizer-0.1-cp310-cp310-linux_x86_64.whl"), check=True)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def get_example_img_list():
|
| 47 |
print('Loading example img list ...')
|
|
@@ -142,7 +146,8 @@ def build_model_viewer_html(save_folder, height=660, width=790, textured=False):
|
|
| 142 |
</div>
|
| 143 |
"""
|
| 144 |
|
| 145 |
-
|
|
|
|
| 146 |
def _gen_shape(
|
| 147 |
caption=None,
|
| 148 |
image=None,
|
|
@@ -249,7 +254,7 @@ def _gen_shape(
|
|
| 249 |
main_image = image if not MV_MODE else image['front']
|
| 250 |
return mesh, main_image, save_folder, stats, seed
|
| 251 |
|
| 252 |
-
@
|
| 253 |
def generation_all(
|
| 254 |
caption=None,
|
| 255 |
image=None,
|
|
@@ -314,7 +319,7 @@ def generation_all(
|
|
| 314 |
seed,
|
| 315 |
)
|
| 316 |
|
| 317 |
-
@
|
| 318 |
def shape_generation(
|
| 319 |
caption=None,
|
| 320 |
image=None,
|
|
|
|
| 31 |
|
| 32 |
MAX_SEED = 1e7
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
import spaces
|
| 36 |
+
from spaces import GPU
|
| 37 |
+
import subprocess
|
| 38 |
+
import sys
|
| 39 |
+
import shlex
|
| 40 |
+
print("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
|
| 41 |
+
os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
|
| 42 |
+
print('install custom')
|
| 43 |
+
subprocess.run(shlex.split("pip install custom_rasterizer-0.1-cp310-cp310-linux_x86_64.whl"), check=True)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@GPU
|
| 47 |
+
def dummy_gpu_function():
|
| 48 |
+
pass
|
| 49 |
|
| 50 |
def get_example_img_list():
|
| 51 |
print('Loading example img list ...')
|
|
|
|
| 146 |
</div>
|
| 147 |
"""
|
| 148 |
|
| 149 |
+
#@spaces.GPU(duration=40)
|
| 150 |
+
@GPU(duration=40)
|
| 151 |
def _gen_shape(
|
| 152 |
caption=None,
|
| 153 |
image=None,
|
|
|
|
| 254 |
main_image = image if not MV_MODE else image['front']
|
| 255 |
return mesh, main_image, save_folder, stats, seed
|
| 256 |
|
| 257 |
+
@GPU(duration=90)
|
| 258 |
def generation_all(
|
| 259 |
caption=None,
|
| 260 |
image=None,
|
|
|
|
| 319 |
seed,
|
| 320 |
)
|
| 321 |
|
| 322 |
+
@GPU(duration=40)
|
| 323 |
def shape_generation(
|
| 324 |
caption=None,
|
| 325 |
image=None,
|