Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
|
@@ -265,7 +265,7 @@ def split_image(image: Image.Image) -> List[Image.Image]:
|
|
| 265 |
images.append(Image.fromarray(image[:, s:e+1]))
|
| 266 |
return [preprocess_image(image) for image in images]
|
| 267 |
|
| 268 |
-
@spaces.GPU
|
| 269 |
def quick_generate_glb(
|
| 270 |
image: Image.Image,
|
| 271 |
multiimages: List[Tuple[Image.Image, str]],
|
|
@@ -341,7 +341,8 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 341 |
with gr.Row():
|
| 342 |
extract_glb_btn = gr.Button("Extract GLB", interactive=False)
|
| 343 |
extract_gs_btn = gr.Button("Extract Gaussian", interactive=False)
|
| 344 |
-
generate_glb_btn = gr.Button("Quick Generate GLB")
|
|
|
|
| 345 |
gr.Markdown("""
|
| 346 |
*NOTE: Gaussian file can be very large (~50MB), it will take a while to display and download.*
|
| 347 |
""")
|
|
@@ -472,6 +473,28 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 472 |
lambda: gr.update(interactive=True),
|
| 473 |
outputs=[download_glb]
|
| 474 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
|
| 477 |
# Launch the Gradio app
|
|
@@ -482,4 +505,4 @@ if __name__ == "__main__":
|
|
| 482 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 483 |
except:
|
| 484 |
pass
|
| 485 |
-
demo.launch(show_error=True)
|
|
|
|
| 265 |
images.append(Image.fromarray(image[:, s:e+1]))
|
| 266 |
return [preprocess_image(image) for image in images]
|
| 267 |
|
| 268 |
+
@spaces.GPU(api_name="quick_generate_glb")
|
| 269 |
def quick_generate_glb(
|
| 270 |
image: Image.Image,
|
| 271 |
multiimages: List[Tuple[Image.Image, str]],
|
|
|
|
| 341 |
with gr.Row():
|
| 342 |
extract_glb_btn = gr.Button("Extract GLB", interactive=False)
|
| 343 |
extract_gs_btn = gr.Button("Extract Gaussian", interactive=False)
|
| 344 |
+
generate_glb_btn = gr.Button("Quick Generate GLB in layout")
|
| 345 |
+
quick_generate_glb_btn = gr.Button("Quick Generate GLB with download")
|
| 346 |
gr.Markdown("""
|
| 347 |
*NOTE: Gaussian file can be very large (~50MB), it will take a while to display and download.*
|
| 348 |
""")
|
|
|
|
| 473 |
lambda: gr.update(interactive=True),
|
| 474 |
outputs=[download_glb]
|
| 475 |
)
|
| 476 |
+
|
| 477 |
+
quick_generate_glb_btn.click(
|
| 478 |
+
fn=quick_generate_glb,
|
| 479 |
+
inputs=[
|
| 480 |
+
image_input,
|
| 481 |
+
gr.State([]), # multiimages
|
| 482 |
+
gr.State(False), # is_multiimage
|
| 483 |
+
gr.State(0), # seed
|
| 484 |
+
gr.State(7.5), # ss_guidance_strength
|
| 485 |
+
gr.State(12), # ss_sampling_steps
|
| 486 |
+
gr.State(3.0), # slat_guidance_strength
|
| 487 |
+
gr.State(12), # slat_sampling_steps
|
| 488 |
+
gr.State("stochastic"), # multiimage_algo
|
| 489 |
+
gr.State(0.95), # mesh_simplify
|
| 490 |
+
gr.State(1024), # texture_size
|
| 491 |
+
],
|
| 492 |
+
outputs=[model_output, glb_download],
|
| 493 |
+
api_name="quick_generate_glb"
|
| 494 |
+
)
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
|
| 498 |
|
| 499 |
|
| 500 |
# Launch the Gradio app
|
|
|
|
| 505 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 506 |
except:
|
| 507 |
pass
|
| 508 |
+
demo.launch(show_error=True,show_api=True)
|