JiantaoLin
commited on
Commit
Β·
b629b81
1
Parent(s):
7cad53a
update interface
Browse files
app.py
CHANGED
@@ -424,7 +424,10 @@ with gr.Blocks(css="""
|
|
424 |
output_video1 = gr.Video(label="Generated Video", interactive=False, loop=True, autoplay=True)
|
425 |
btn_download1 = gr.Button("Download Mesh")
|
426 |
|
427 |
-
|
|
|
|
|
|
|
428 |
|
429 |
with gr.TabItem('Image-to-3D', id='tab_image_to_3d'):
|
430 |
with gr.Row():
|
@@ -437,37 +440,45 @@ with gr.Blocks(css="""
|
|
437 |
|
438 |
image_caption = gr.Textbox(value="", label="Image Caption", placeholder="caption will be generated here base on your input image. You can also edit this caption", lines=4, interactive=True)
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
445 |
|
446 |
btn_img2mesh_main = gr.Button("Generate Mesh")
|
447 |
|
448 |
with gr.Column(scale=1):
|
449 |
|
450 |
# output_mesh2 = gr.Model3D(label="Generated Mesh", interactive=False)
|
451 |
-
output_image3 = gr.Image(label="
|
452 |
output_video2 = gr.Video(label="Generated Video", interactive=False, loop=True, autoplay=True)
|
453 |
-
btn_download2 = gr.Button("Download Mesh")
|
454 |
-
|
|
|
455 |
|
456 |
# Image2
|
457 |
btn_img2mesh_preprocess.click(fn=image2mesh_preprocess_, inputs=[image, seed2], outputs=[output_image2, image_caption])
|
458 |
|
459 |
-
btn_img2mesh_main.click(fn=image2mesh_main_, inputs=[output_image2, image_caption, seed2, strength1, strength2, enable_redux, use_controlnet], outputs=[output_image3, output_video2])
|
|
|
|
|
|
|
460 |
|
461 |
|
462 |
-
btn_download1.click(fn=save_cached_mesh, inputs=[], outputs=file_output1)
|
463 |
-
btn_download2.click(fn=save_cached_mesh, inputs=[], outputs=file_output2)
|
464 |
|
465 |
|
466 |
# Button Click Events
|
467 |
# Text2
|
468 |
btn_text2detailed.click(fn=text_to_detailed, inputs=[prompt, seed1], outputs=detailed_prompt)
|
469 |
btn_text2img.click(fn=text_to_image, inputs=[detailed_prompt, seed1], outputs=output_image1)
|
470 |
-
btn_gen_mesh.click(fn=bundle_image_to_mesh, inputs=[output_image1,], outputs=output_video1)
|
|
|
|
|
|
|
471 |
# btn_gen_mesh.click(fn=bundle_image_to_mesh, inputs=[output_image1, lrm_radius, isomer_radius, reconstruction_stage1_steps, reconstruction_stage2_steps], outputs=output_video1)
|
472 |
|
473 |
with gr.Row():
|
|
|
424 |
output_video1 = gr.Video(label="Generated Video", interactive=False, loop=True, autoplay=True)
|
425 |
btn_download1 = gr.Button("Download Mesh")
|
426 |
|
427 |
+
|
428 |
+
download_1 = gr.DownloadButton(label="Download mesh", interactive=False)
|
429 |
+
|
430 |
+
# file_output1 = gr.File()
|
431 |
|
432 |
with gr.TabItem('Image-to-3D', id='tab_image_to_3d'):
|
433 |
with gr.Row():
|
|
|
440 |
|
441 |
image_caption = gr.Textbox(value="", label="Image Caption", placeholder="caption will be generated here base on your input image. You can also edit this caption", lines=4, interactive=True)
|
442 |
|
443 |
+
with gr.Accordion(label="Extra Settings", open=False):
|
444 |
+
output_image2 = gr.Image(label="Generated image", interactive=False)
|
445 |
+
strength1 = gr.Slider(minimum=0, maximum=1.0, step=0.01, value=0.5, label="redux strength")
|
446 |
+
strength2 = gr.Slider(minimum=0, maximum=1.0, step=0.01, value=0.95, label="denoise strength")
|
447 |
+
enable_redux = gr.Checkbox(label="enable redux", value=True)
|
448 |
+
use_controlnet = gr.Checkbox(label="enable controlnet", value=True)
|
449 |
|
450 |
btn_img2mesh_main = gr.Button("Generate Mesh")
|
451 |
|
452 |
with gr.Column(scale=1):
|
453 |
|
454 |
# output_mesh2 = gr.Model3D(label="Generated Mesh", interactive=False)
|
455 |
+
output_image3 = gr.Image(label="Final Bundle Image", interactive=False)
|
456 |
output_video2 = gr.Video(label="Generated Video", interactive=False, loop=True, autoplay=True)
|
457 |
+
# btn_download2 = gr.Button("Download Mesh")
|
458 |
+
download_2 = gr.DownloadButton(label="Download mesh", interactive=False)
|
459 |
+
# file_output2 = gr.File()
|
460 |
|
461 |
# Image2
|
462 |
btn_img2mesh_preprocess.click(fn=image2mesh_preprocess_, inputs=[image, seed2], outputs=[output_image2, image_caption])
|
463 |
|
464 |
+
btn_img2mesh_main.click(fn=image2mesh_main_, inputs=[output_image2, image_caption, seed2, strength1, strength2, enable_redux, use_controlnet], outputs=[output_image3, output_video2, download_2]).then(
|
465 |
+
lambda: gr.Button(interactive=True),
|
466 |
+
outputs=[download_2],
|
467 |
+
)
|
468 |
|
469 |
|
470 |
+
# btn_download1.click(fn=save_cached_mesh, inputs=[], outputs=file_output1)
|
471 |
+
# btn_download2.click(fn=save_cached_mesh, inputs=[], outputs=file_output2)
|
472 |
|
473 |
|
474 |
# Button Click Events
|
475 |
# Text2
|
476 |
btn_text2detailed.click(fn=text_to_detailed, inputs=[prompt, seed1], outputs=detailed_prompt)
|
477 |
btn_text2img.click(fn=text_to_image, inputs=[detailed_prompt, seed1], outputs=output_image1)
|
478 |
+
btn_gen_mesh.click(fn=bundle_image_to_mesh, inputs=[output_image1,], outputs=[output_video1, download_1]).then(
|
479 |
+
lambda: gr.Button(interactive=True),
|
480 |
+
outputs=[download_1],
|
481 |
+
)
|
482 |
# btn_gen_mesh.click(fn=bundle_image_to_mesh, inputs=[output_image1, lrm_radius, isomer_radius, reconstruction_stage1_steps, reconstruction_stage2_steps], outputs=output_video1)
|
483 |
|
484 |
with gr.Row():
|