Spaces:
Running
on
Zero
Running
on
Zero
Upload gradio_app.py with huggingface_hub
Browse files- gradio_app.py +31 -8
gradio_app.py
CHANGED
@@ -26,9 +26,9 @@ os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && pip install .")
|
|
26 |
import shutil
|
27 |
import time
|
28 |
from glob import glob
|
29 |
-
|
30 |
import gradio as gr
|
31 |
import torch
|
|
|
32 |
|
33 |
import spaces
|
34 |
|
@@ -187,8 +187,10 @@ def generation_all(
|
|
187 |
return (
|
188 |
gr.update(value=path, visible=True),
|
189 |
gr.update(value=path_textured, visible=True),
|
190 |
-
|
191 |
-
|
|
|
|
|
192 |
)
|
193 |
|
194 |
@spaces.GPU(duration=30)
|
@@ -216,7 +218,8 @@ def shape_generation(
|
|
216 |
|
217 |
return (
|
218 |
gr.update(value=path, visible=True),
|
219 |
-
|
|
|
220 |
)
|
221 |
|
222 |
|
@@ -280,9 +283,27 @@ def build_app():
|
|
280 |
with gr.Column(scale=5):
|
281 |
with gr.Tabs():
|
282 |
with gr.Tab('Generated Mesh') as mesh1:
|
283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
with gr.Tab('Generated Textured Mesh') as mesh2:
|
285 |
-
html_output2 = gr.HTML(HTML_OUTPUT_PLACEHOLDER, label='Output')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
|
287 |
with gr.Column(scale=2):
|
288 |
with gr.Tabs() as gallery:
|
@@ -310,7 +331,8 @@ def build_app():
|
|
310 |
octree_resolution,
|
311 |
check_box_rembg,
|
312 |
],
|
313 |
-
outputs=[file_out, html_output1]
|
|
|
314 |
).then(
|
315 |
lambda: gr.update(visible=True),
|
316 |
outputs=[file_out],
|
@@ -327,7 +349,8 @@ def build_app():
|
|
327 |
octree_resolution,
|
328 |
check_box_rembg,
|
329 |
],
|
330 |
-
outputs=[file_out, file_out2, html_output1, html_output2]
|
|
|
331 |
).then(
|
332 |
lambda: (gr.update(visible=True), gr.update(visible=True)),
|
333 |
outputs=[file_out, file_out2],
|
|
|
26 |
import shutil
|
27 |
import time
|
28 |
from glob import glob
|
|
|
29 |
import gradio as gr
|
30 |
import torch
|
31 |
+
from gradio_litmodel3d import LitModel3D
|
32 |
|
33 |
import spaces
|
34 |
|
|
|
187 |
return (
|
188 |
gr.update(value=path, visible=True),
|
189 |
gr.update(value=path_textured, visible=True),
|
190 |
+
gr.update(value=path, visible=True),
|
191 |
+
gr.update(value=path_textured, visible=True),
|
192 |
+
# model_viewer_html,
|
193 |
+
# model_viewer_html_textured,
|
194 |
)
|
195 |
|
196 |
@spaces.GPU(duration=30)
|
|
|
218 |
|
219 |
return (
|
220 |
gr.update(value=path, visible=True),
|
221 |
+
gr.update(value=path, visible=True),
|
222 |
+
# model_viewer_html,
|
223 |
)
|
224 |
|
225 |
|
|
|
283 |
with gr.Column(scale=5):
|
284 |
with gr.Tabs():
|
285 |
with gr.Tab('Generated Mesh') as mesh1:
|
286 |
+
mesh_output1 = LitModel3D(
|
287 |
+
label="3D Model",
|
288 |
+
exposure=10.0, # height=300,
|
289 |
+
visible=False,
|
290 |
+
clear_color=[0.0, 0.0, 0.0, 0.0],
|
291 |
+
tonemapping="aces",
|
292 |
+
contrast=1.0,
|
293 |
+
scale=1.0,
|
294 |
+
)
|
295 |
+
# html_output1 = gr.HTML(HTML_OUTPUT_PLACEHOLDER, label='Output')
|
296 |
with gr.Tab('Generated Textured Mesh') as mesh2:
|
297 |
+
# html_output2 = gr.HTML(HTML_OUTPUT_PLACEHOLDER, label='Output')
|
298 |
+
mesh_output2 = LitModel3D(
|
299 |
+
label="3D Model",
|
300 |
+
exposure=10.0, # height=300,
|
301 |
+
visible=False,
|
302 |
+
clear_color=[0.0, 0.0, 0.0, 0.0],
|
303 |
+
tonemapping="aces",
|
304 |
+
contrast=1.0,
|
305 |
+
scale=1.0,
|
306 |
+
)
|
307 |
|
308 |
with gr.Column(scale=2):
|
309 |
with gr.Tabs() as gallery:
|
|
|
331 |
octree_resolution,
|
332 |
check_box_rembg,
|
333 |
],
|
334 |
+
# outputs=[file_out, html_output1]
|
335 |
+
outputs=[file_out, mesh_output1]
|
336 |
).then(
|
337 |
lambda: gr.update(visible=True),
|
338 |
outputs=[file_out],
|
|
|
349 |
octree_resolution,
|
350 |
check_box_rembg,
|
351 |
],
|
352 |
+
# outputs=[file_out, file_out2, html_output1, html_output2]
|
353 |
+
outputs=[file_out, file_out2, mesh_output1, mesh_output2]
|
354 |
).then(
|
355 |
lambda: (gr.update(visible=True), gr.update(visible=True)),
|
356 |
outputs=[file_out, file_out2],
|