Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -703,6 +703,8 @@ HEADER = """
|
|
703 |
</style>
|
704 |
"""
|
705 |
|
|
|
|
|
706 |
# Gradio web interface
|
707 |
try:
|
708 |
logger.info("Initializing Gradio Blocks interface")
|
@@ -736,7 +738,7 @@ try:
|
|
736 |
minimum=8,
|
737 |
maximum=50,
|
738 |
step=1,
|
739 |
-
value=30,
|
740 |
info="Higher steps enhance detail but increase processing time",
|
741 |
elem_classes="gr-slider"
|
742 |
)
|
@@ -766,11 +768,28 @@ try:
|
|
766 |
download_button = gr.Button("Download GLB", variant="secondary", elem_classes="gr-button-secondary")
|
767 |
with gr.Tab("Cosmic Gallery"):
|
768 |
gr.Markdown("### Discover Stellar Creations")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
gr.Examples(
|
770 |
-
examples=
|
771 |
-
f"{TRIPOSG_CODE_DIR}/assets/example_data/{image}"
|
772 |
-
for image in os.listdir(f"{TRIPOSG_CODE_DIR}/assets/example_data")
|
773 |
-
],
|
774 |
fn=run_full,
|
775 |
inputs=[image_prompts, seed, num_inference_steps, guidance_scale, reduce_face, target_face_num, style_filter],
|
776 |
outputs=[seg_image, model_output, textured_model_output],
|
|
|
703 |
</style>
|
704 |
"""
|
705 |
|
706 |
+
# ... [Previous imports and code unchanged until the Gradio Blocks interface] ...
|
707 |
+
|
708 |
# Gradio web interface
|
709 |
try:
|
710 |
logger.info("Initializing Gradio Blocks interface")
|
|
|
738 |
minimum=8,
|
739 |
maximum=50,
|
740 |
step=1,
|
741 |
+
value=30,
|
742 |
info="Higher steps enhance detail but increase processing time",
|
743 |
elem_classes="gr-slider"
|
744 |
)
|
|
|
768 |
download_button = gr.Button("Download GLB", variant="secondary", elem_classes="gr-button-secondary")
|
769 |
with gr.Tab("Cosmic Gallery"):
|
770 |
gr.Markdown("### Discover Stellar Creations")
|
771 |
+
# Ensure example directory exists and contains valid images
|
772 |
+
example_dir = f"{TRIPOSG_CODE_DIR}/assets/example_data"
|
773 |
+
examples = []
|
774 |
+
if os.path.exists(example_dir):
|
775 |
+
valid_extensions = (".png", ".jpg", ".jpeg")
|
776 |
+
examples = [
|
777 |
+
[
|
778 |
+
os.path.join(example_dir, image), # image
|
779 |
+
0, # seed
|
780 |
+
30, # num_inference_steps
|
781 |
+
7.5, # guidance_scale
|
782 |
+
True, # reduce_face
|
783 |
+
DEFAULT_FACE_NUMBER, # target_face_num
|
784 |
+
"None" # style_filter
|
785 |
+
]
|
786 |
+
for image in os.listdir(example_dir)
|
787 |
+
if image.lower().endswith(valid_extensions)
|
788 |
+
]
|
789 |
+
if not examples:
|
790 |
+
logger.warning(f"No valid images found in {example_dir}, skipping examples")
|
791 |
gr.Examples(
|
792 |
+
examples=examples,
|
|
|
|
|
|
|
793 |
fn=run_full,
|
794 |
inputs=[image_prompts, seed, num_inference_steps, guidance_scale, reduce_face, target_face_num, style_filter],
|
795 |
outputs=[seg_image, model_output, textured_model_output],
|