Spaces:
Running
on
L40S
Running
on
L40S
Upload app_hg.py with huggingface_hub
Browse files
app_hg.py
CHANGED
@@ -116,11 +116,15 @@ CONST_SERVER = '0.0.0.0'
|
|
116 |
|
117 |
CONST_HEADER = '''
|
118 |
<h2><a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'><b>Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation</b></a></h2>
|
119 |
-
|
120 |
|
121 |
-
❗️❗️❗️**Important Notes
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
'''
|
125 |
|
126 |
################################################################
|
@@ -253,18 +257,18 @@ with gr.Blocks() as demo:
|
|
253 |
text = gr.TextArea('一只黑白相间的熊猫在白色背景上居中坐着,呈现出卡通风格和可爱氛围。', lines=1, max_lines=10, label='Input text')
|
254 |
with gr.Row():
|
255 |
textgen_seed = gr.Number(value=0, label="T2I seed", precision=0)
|
256 |
-
textgen_step = gr.Number(value=25, label="T2I
|
257 |
textgen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
258 |
-
textgen_STEP = gr.Number(value=50, label="Gen
|
259 |
-
textgen_max_faces = gr.Number(value=90000, label="
|
260 |
|
261 |
with gr.Row():
|
262 |
-
# textgen_do_texture_mapping = gr.Checkbox(label="
|
263 |
-
# textgen_do_render_gif = gr.Checkbox(label="Render
|
264 |
textgen_submit = gr.Button("Generate", variant="primary")
|
265 |
|
266 |
with gr.Row():
|
267 |
-
gr.Examples(examples=example_ts, inputs=[text], label="
|
268 |
|
269 |
with gr.Tab("Image to 3D"):
|
270 |
with gr.Column():
|
@@ -274,12 +278,12 @@ with gr.Blocks() as demo:
|
|
274 |
interactive=True)
|
275 |
with gr.Row():
|
276 |
imggen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
277 |
-
imggen_STEP = gr.Number(value=50, label="Gen
|
278 |
-
imggen_max_faces = gr.Number(value=90000, label="
|
279 |
|
280 |
with gr.Row():
|
281 |
-
# imggen_do_texture_mapping = gr.Checkbox(label="
|
282 |
-
# imggen_do_render_gif = gr.Checkbox(label="Render
|
283 |
imggen_submit = gr.Button("Generate", variant="primary")
|
284 |
with gr.Row():
|
285 |
gr.Examples(examples=example_is, inputs=[input_image], label="Img examples", examples_per_page=10)
|
@@ -287,15 +291,15 @@ with gr.Blocks() as demo:
|
|
287 |
with gr.Column(scale=3):
|
288 |
with gr.Row():
|
289 |
with gr.Column(scale=2):
|
290 |
-
rem_bg_image = gr.Image(label="
|
291 |
image_mode="RGBA", interactive=False)
|
292 |
with gr.Column(scale=3):
|
293 |
-
result_image = gr.Image(label="Multi
|
294 |
|
295 |
with gr.Row():
|
296 |
result_3dobj = gr.Model3D(
|
297 |
clear_color=[0.0, 0.0, 0.0, 0.0],
|
298 |
-
label="
|
299 |
show_label=True,
|
300 |
visible=True,
|
301 |
camera_position=[90, 90, None],
|
@@ -304,7 +308,7 @@ with gr.Blocks() as demo:
|
|
304 |
|
305 |
result_3dglb = gr.Model3D(
|
306 |
clear_color=[0.0, 0.0, 0.0, 0.0],
|
307 |
-
label="
|
308 |
show_label=True,
|
309 |
visible=True,
|
310 |
camera_position=[90, 90, None],
|
@@ -313,11 +317,7 @@ with gr.Blocks() as demo:
|
|
313 |
# result_gif = gr.Image(label="Rendered GIF", interactive=False)
|
314 |
|
315 |
with gr.Row():
|
316 |
-
gr.Markdown("""
|
317 |
-
We recommend download and open Glb using 3D software, such as Blender, MeshLab, etc.
|
318 |
-
|
319 |
-
Limited by gradio, Obj file here only be shown as vertex shading, but Glb can be texture shading.
|
320 |
-
""")
|
321 |
|
322 |
#===============================================================
|
323 |
textgen_do_texture_mapping = gr.State(False)
|
|
|
116 |
|
117 |
CONST_HEADER = '''
|
118 |
<h2><a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'><b>Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation</b></a></h2>
|
119 |
+
⭐️Technical report: <a href='https://arxiv.org/pdf/2411.02293' target='_blank'>ArXiv</a>. ⭐️Code: <a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'>GitHub</a>.
|
120 |
|
121 |
+
❗️❗️❗️**Important Notes**
|
122 |
+
|
123 |
+
Our demo allows you to export models in various formats:
|
124 |
+
- By default, export as a *.obj mesh with vertex colors or a *.glb mesh.
|
125 |
+
- Select "texture mapping" to export a *.obj mesh with a texture map or a *.glb mesh.
|
126 |
+
- Select "render GIF" to export a GIF rendering of the *.glb file.
|
127 |
+
If the results aren't satisfactory, try using a different seed value (default is 0).
|
128 |
'''
|
129 |
|
130 |
################################################################
|
|
|
257 |
text = gr.TextArea('一只黑白相间的熊猫在白色背景上居中坐着,呈现出卡通风格和可爱氛围。', lines=1, max_lines=10, label='Input text')
|
258 |
with gr.Row():
|
259 |
textgen_seed = gr.Number(value=0, label="T2I seed", precision=0)
|
260 |
+
textgen_step = gr.Number(value=25, label="T2I steps", precision=0, minimum=10, maximum=50)
|
261 |
textgen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
262 |
+
textgen_STEP = gr.Number(value=50, label="Gen steps", precision=0, minimum=40, maximum=100)
|
263 |
+
textgen_max_faces = gr.Number(value=90000, label="Face number", precision=0, minimum=5000, maximum=1000000)
|
264 |
|
265 |
with gr.Row():
|
266 |
+
# textgen_do_texture_mapping = gr.Checkbox(label="Texture mapping", value=False, interactive=True)
|
267 |
+
# textgen_do_render_gif = gr.Checkbox(label="Render GIF", value=False, interactive=True)
|
268 |
textgen_submit = gr.Button("Generate", variant="primary")
|
269 |
|
270 |
with gr.Row():
|
271 |
+
gr.Examples(examples=example_ts, inputs=[text], label="Text examples", examples_per_page=10)
|
272 |
|
273 |
with gr.Tab("Image to 3D"):
|
274 |
with gr.Column():
|
|
|
278 |
interactive=True)
|
279 |
with gr.Row():
|
280 |
imggen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
281 |
+
imggen_STEP = gr.Number(value=50, label="Gen steps", precision=0, minimum=40, maximum=100)
|
282 |
+
imggen_max_faces = gr.Number(value=90000, label="Face number", precision=0, minimum=5000, maximum=1000000)
|
283 |
|
284 |
with gr.Row():
|
285 |
+
# imggen_do_texture_mapping = gr.Checkbox(label="Texture mapping", value=False, interactive=True)
|
286 |
+
# imggen_do_render_gif = gr.Checkbox(label="Render GIF", value=False, interactive=True)
|
287 |
imggen_submit = gr.Button("Generate", variant="primary")
|
288 |
with gr.Row():
|
289 |
gr.Examples(examples=example_is, inputs=[input_image], label="Img examples", examples_per_page=10)
|
|
|
291 |
with gr.Column(scale=3):
|
292 |
with gr.Row():
|
293 |
with gr.Column(scale=2):
|
294 |
+
rem_bg_image = gr.Image(label="Image without background", type="pil",
|
295 |
image_mode="RGBA", interactive=False)
|
296 |
with gr.Column(scale=3):
|
297 |
+
result_image = gr.Image(label="Multi-view images", type="pil", interactive=False)
|
298 |
|
299 |
with gr.Row():
|
300 |
result_3dobj = gr.Model3D(
|
301 |
clear_color=[0.0, 0.0, 0.0, 0.0],
|
302 |
+
label="OBJ",
|
303 |
show_label=True,
|
304 |
visible=True,
|
305 |
camera_position=[90, 90, None],
|
|
|
308 |
|
309 |
result_3dglb = gr.Model3D(
|
310 |
clear_color=[0.0, 0.0, 0.0, 0.0],
|
311 |
+
label="GLB",
|
312 |
show_label=True,
|
313 |
visible=True,
|
314 |
camera_position=[90, 90, None],
|
|
|
317 |
# result_gif = gr.Image(label="Rendered GIF", interactive=False)
|
318 |
|
319 |
with gr.Row():
|
320 |
+
gr.Markdown("""Due to Gradio limitations, OBJ files are displayed with vertex shading only, while GLB files can be viewed with texture shading. For the best experience, we recommend downloading the GLB files and opening them with 3D software like Blender or MeshLab.""")
|
|
|
|
|
|
|
|
|
321 |
|
322 |
#===============================================================
|
323 |
textgen_do_texture_mapping = gr.State(False)
|