Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -676,7 +676,7 @@ def extract_glb(
|
|
| 676 |
# GRADIO INTERFACE
|
| 677 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 678 |
|
| 679 |
-
with gr.Blocks(
|
| 680 |
|
| 681 |
# Header
|
| 682 |
gr.HTML("""
|
|
@@ -708,7 +708,6 @@ with gr.Blocks(css=css, head=head, theme=gr.themes.Base(primary_hue="indigo"), d
|
|
| 708 |
with gr.Walkthrough(selected=0) as walkthrough:
|
| 709 |
with gr.Step("Preview", id=0):
|
| 710 |
preview_output = gr.HTML(empty_html, label="3D Preview", show_label=False)
|
| 711 |
-
extract_btn = gr.Button("Extract GLB", elem_classes=["secondary-btn"], size="lg")
|
| 712 |
|
| 713 |
with gr.Step("Export", id=1):
|
| 714 |
glb_output = gr.Model3D(
|
|
@@ -716,12 +715,12 @@ with gr.Blocks(css=css, head=head, theme=gr.themes.Base(primary_hue="indigo"), d
|
|
| 716 |
height=640,
|
| 717 |
show_label=False,
|
| 718 |
display_mode="solid",
|
| 719 |
-
clear_color=(0.06, 0.06, 0.07,
|
| 720 |
)
|
| 721 |
download_btn = gr.DownloadButton("Download GLB", elem_classes=["primary-btn"], size="lg")
|
| 722 |
|
| 723 |
# Footer
|
| 724 |
-
gr.HTML('<div class="footer-note">GLB extraction may take
|
| 725 |
|
| 726 |
output_buf = gr.State()
|
| 727 |
|
|
@@ -735,15 +734,14 @@ with gr.Blocks(css=css, head=head, theme=gr.themes.Base(primary_hue="indigo"), d
|
|
| 735 |
outputs=[image_prompt],
|
| 736 |
)
|
| 737 |
|
|
|
|
| 738 |
generate_btn.click(
|
| 739 |
lambda: gr.Walkthrough(selected=0), outputs=walkthrough
|
| 740 |
).then(
|
| 741 |
image_to_3d,
|
| 742 |
inputs=[image_prompt],
|
| 743 |
outputs=[output_buf, preview_output],
|
| 744 |
-
)
|
| 745 |
-
|
| 746 |
-
extract_btn.click(
|
| 747 |
lambda: gr.Walkthrough(selected=1), outputs=walkthrough
|
| 748 |
).then(
|
| 749 |
extract_glb,
|
|
@@ -785,4 +783,4 @@ if __name__ == "__main__":
|
|
| 785 |
)),
|
| 786 |
}
|
| 787 |
|
| 788 |
-
demo.launch()
|
|
|
|
| 676 |
# GRADIO INTERFACE
|
| 677 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 678 |
|
| 679 |
+
with gr.Blocks(theme=gr.themes.Base(primary_hue="indigo"), delete_cache=(600, 600)) as demo:
|
| 680 |
|
| 681 |
# Header
|
| 682 |
gr.HTML("""
|
|
|
|
| 708 |
with gr.Walkthrough(selected=0) as walkthrough:
|
| 709 |
with gr.Step("Preview", id=0):
|
| 710 |
preview_output = gr.HTML(empty_html, label="3D Preview", show_label=False)
|
|
|
|
| 711 |
|
| 712 |
with gr.Step("Export", id=1):
|
| 713 |
glb_output = gr.Model3D(
|
|
|
|
| 715 |
height=640,
|
| 716 |
show_label=False,
|
| 717 |
display_mode="solid",
|
| 718 |
+
clear_color=(0.06, 0.06, 0.07, 0.0) # Alpha = 0 for transparent background
|
| 719 |
)
|
| 720 |
download_btn = gr.DownloadButton("Download GLB", elem_classes=["primary-btn"], size="lg")
|
| 721 |
|
| 722 |
# Footer
|
| 723 |
+
gr.HTML('<div class="footer-note">Generation includes automatic GLB extraction. This may take 60+ seconds total.</div>')
|
| 724 |
|
| 725 |
output_buf = gr.State()
|
| 726 |
|
|
|
|
| 734 |
outputs=[image_prompt],
|
| 735 |
)
|
| 736 |
|
| 737 |
+
# Generate 3D now automatically chains to Extract GLB
|
| 738 |
generate_btn.click(
|
| 739 |
lambda: gr.Walkthrough(selected=0), outputs=walkthrough
|
| 740 |
).then(
|
| 741 |
image_to_3d,
|
| 742 |
inputs=[image_prompt],
|
| 743 |
outputs=[output_buf, preview_output],
|
| 744 |
+
).then(
|
|
|
|
|
|
|
| 745 |
lambda: gr.Walkthrough(selected=1), outputs=walkthrough
|
| 746 |
).then(
|
| 747 |
extract_glb,
|
|
|
|
| 783 |
)),
|
| 784 |
}
|
| 785 |
|
| 786 |
+
demo.launch(css=css, head=head)
|