Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -512,47 +512,29 @@ with gr.Blocks() as demo:
|
|
512 |
interactive=False,
|
513 |
)
|
514 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
|
|
|
|
|
|
|
|
|
|
515 |
with gr.Row():
|
516 |
-
gr.
|
517 |
-
|
518 |
-
|
519 |
-
mv_images = gr.State()
|
520 |
-
|
521 |
-
step1_submit.click(fn=check_input_image, inputs=[input_image]).success(
|
522 |
-
fn=preprocess,
|
523 |
-
inputs=[input_image, do_remove_background],
|
524 |
-
outputs=[processed_image],
|
525 |
-
).success(
|
526 |
-
fn=generate_mvs,
|
527 |
-
inputs=[processed_image, sample_steps, sample_seed],
|
528 |
-
outputs=[mv_images, mv_show_images],
|
529 |
-
).success(
|
530 |
-
fn=make3d,
|
531 |
-
inputs=[mv_images],
|
532 |
-
outputs=[output_model_obj, output_model_glb]
|
533 |
-
)
|
534 |
-
|
535 |
-
gr.Markdown(STEP2_HEADER)
|
536 |
-
with gr.Row(variant="panel"):
|
537 |
-
with gr.Column():
|
538 |
-
with gr.Row():
|
539 |
-
input_3d = gr.Model3D(
|
540 |
label="Input Mesh",
|
541 |
display_mode="wireframe",
|
542 |
clear_color=[1,1,1,1],
|
543 |
)
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
|
551 |
-
|
552 |
-
|
553 |
|
554 |
-
|
555 |
-
|
556 |
examples=[
|
557 |
os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
558 |
],
|
@@ -563,28 +545,46 @@ with gr.Blocks() as demo:
|
|
563 |
examples_per_page=10
|
564 |
)
|
565 |
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
fn=do_inference,
|
582 |
inputs=[input_3d, sample_seed, do_sampling, do_marching_cubes],
|
583 |
outputs=[preprocess_model_obj, input_image_render, output_model_obj, output_image_render],
|
584 |
-
|
|
|
585 |
|
586 |
-
gr.Markdown(STEP3_HEADER)
|
587 |
-
gr.Markdown(STEP4_HEADER)
|
588 |
|
589 |
demo.queue(max_size=10)
|
590 |
demo.launch()
|
|
|
512 |
interactive=False,
|
513 |
)
|
514 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
515 |
+
gr.Markdown('''Try a different <b>seed value</b> if the result is unsatisfying (Default: 42).''')
|
516 |
+
with gr.Row():
|
517 |
+
gr.Markdown(STEP2_HEADER)
|
518 |
+
with gr.Row(variant="panel"):
|
519 |
+
with gr.Column():
|
520 |
with gr.Row():
|
521 |
+
input_3d = gr.Model3D(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
label="Input Mesh",
|
523 |
display_mode="wireframe",
|
524 |
clear_color=[1,1,1,1],
|
525 |
)
|
526 |
|
527 |
+
with gr.Row():
|
528 |
+
with gr.Group():
|
529 |
+
do_marching_cubes = gr.Checkbox(label="Preprocess with Marching Cubes", value=False)
|
530 |
+
do_sampling = gr.Checkbox(label="Random Sampling", value=False)
|
531 |
+
sample_seed = gr.Number(value=0, label="Seed Value", precision=0)
|
532 |
|
533 |
+
with gr.Row():
|
534 |
+
step2_submit = gr.Button("Generate", elem_id="generate", variant="primary")
|
535 |
|
536 |
+
with gr.Row(variant="panel"):
|
537 |
+
mesh_examples = gr.Examples(
|
538 |
examples=[
|
539 |
os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
540 |
],
|
|
|
545 |
examples_per_page=10
|
546 |
)
|
547 |
|
548 |
+
with gr.Column():
|
549 |
+
with gr.Row():
|
550 |
+
input_image_render.render()
|
551 |
+
with gr.Row():
|
552 |
+
with gr.Tab("OBJ"):
|
553 |
+
preprocess_model_obj.render()
|
554 |
+
with gr.Row():
|
555 |
+
output_image_render.render()
|
556 |
+
with gr.Row():
|
557 |
+
with gr.Tab("OBJ"):
|
558 |
+
output_model_obj.render()
|
559 |
+
with gr.Row():
|
560 |
+
gr.Markdown('''Try click random sampling and different <b>Seed Value</b> if the result is unsatisfying''')
|
561 |
+
|
562 |
+
gr.Markdown(STEP3_HEADER)
|
563 |
+
gr.Markdown(STEP4_HEADER)
|
564 |
+
|
565 |
+
mv_images = gr.State()
|
566 |
+
|
567 |
+
step1_submit.click(fn=check_input_image, inputs=[input_image]).success(
|
568 |
+
fn=preprocess,
|
569 |
+
inputs=[input_image, do_remove_background],
|
570 |
+
outputs=[processed_image],
|
571 |
+
).success(
|
572 |
+
fn=generate_mvs,
|
573 |
+
inputs=[processed_image, sample_steps, sample_seed],
|
574 |
+
outputs=[mv_images, mv_show_images],
|
575 |
+
).success(
|
576 |
+
fn=make3d,
|
577 |
+
inputs=[mv_images],
|
578 |
+
outputs=[output_model_obj, output_model_glb]
|
579 |
+
)
|
580 |
+
|
581 |
+
step2_submit.click(
|
582 |
fn=do_inference,
|
583 |
inputs=[input_3d, sample_seed, do_sampling, do_marching_cubes],
|
584 |
outputs=[preprocess_model_obj, input_image_render, output_model_obj, output_image_render],
|
585 |
+
)
|
586 |
+
|
587 |
|
|
|
|
|
588 |
|
589 |
demo.queue(max_size=10)
|
590 |
demo.launch()
|