Spaces:
Runtime error
Runtime error
Fabrice-TIERCELIN
commited on
Commit
•
ae7a0f2
1
Parent(s):
5ce6f7e
This PR orders the components more naturally
Browse files- gradio_app/gradio_3dgen.py +20 -19
gradio_app/gradio_3dgen.py
CHANGED
@@ -8,7 +8,6 @@ from gradio_app.custom_models.mvimg_prediction import run_mvprediction
|
|
8 |
from gradio_app.custom_models.normal_prediction import predict_normals
|
9 |
from scripts.refine_lr_to_sr import run_sr_fast
|
10 |
from scripts.utils import save_obj_and_video
|
11 |
-
# from scripts.multiview_inference import geo_reconstruct
|
12 |
from scripts.multiview_inference import geo_reconstruct_part1, geo_reconstruct_part2, geo_reconstruct_part3
|
13 |
|
14 |
@spaces.GPU(duration=200)
|
@@ -44,25 +43,9 @@ def generate3dv2(preview_img, input_processing, seed, render_video=True, do_refi
|
|
44 |
#######################################
|
45 |
def create_ui(concurrency_id="wkl"):
|
46 |
with gr.Row():
|
|
|
47 |
with gr.Column(scale=1):
|
48 |
input_image = gr.Image(type='pil', image_mode='RGBA', label='Frontview')
|
49 |
-
|
50 |
-
example_folder = os.path.join(os.path.dirname(__file__), "./examples")
|
51 |
-
example_fns = sorted([os.path.join(example_folder, example) for example in os.listdir(example_folder)])
|
52 |
-
gr.Examples(
|
53 |
-
examples=example_fns,
|
54 |
-
inputs=[input_image],
|
55 |
-
cache_examples=False,
|
56 |
-
label='Examples',
|
57 |
-
examples_per_page=12
|
58 |
-
)
|
59 |
-
|
60 |
-
|
61 |
-
with gr.Column(scale=1):
|
62 |
-
# export mesh display
|
63 |
-
output_mesh = gr.Model3D(value=None, label="Mesh Model", show_label=True, height=320)
|
64 |
-
output_video = gr.Video(label="Preview", show_label=True, show_share_button=True, height=320, visible=False)
|
65 |
-
|
66 |
input_processing = gr.Checkbox(
|
67 |
value=True,
|
68 |
label='Remove Background',
|
@@ -72,8 +55,26 @@ def create_ui(concurrency_id="wkl"):
|
|
72 |
expansion_weight = gr.Slider(minimum=-1., maximum=1.0, value=0.1, step=0.1, label="Expansion Weight", visible=False)
|
73 |
init_type = gr.Dropdown(choices=["std", "thin"], label="Mesh Initialization", value="std", visible=False)
|
74 |
setable_seed = gr.Slider(-1, 1000000000, -1, step=1, visible=True, label="Seed")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
render_video = gr.Checkbox(value=False, visible=False, label="generate video")
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
fullrunv2_btn.click(
|
79 |
fn = generate3dv2,
|
|
|
8 |
from gradio_app.custom_models.normal_prediction import predict_normals
|
9 |
from scripts.refine_lr_to_sr import run_sr_fast
|
10 |
from scripts.utils import save_obj_and_video
|
|
|
11 |
from scripts.multiview_inference import geo_reconstruct_part1, geo_reconstruct_part2, geo_reconstruct_part3
|
12 |
|
13 |
@spaces.GPU(duration=200)
|
|
|
43 |
#######################################
|
44 |
def create_ui(concurrency_id="wkl"):
|
45 |
with gr.Row():
|
46 |
+
# Inputs
|
47 |
with gr.Column(scale=1):
|
48 |
input_image = gr.Image(type='pil', image_mode='RGBA', label='Frontview')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
input_processing = gr.Checkbox(
|
50 |
value=True,
|
51 |
label='Remove Background',
|
|
|
55 |
expansion_weight = gr.Slider(minimum=-1., maximum=1.0, value=0.1, step=0.1, label="Expansion Weight", visible=False)
|
56 |
init_type = gr.Dropdown(choices=["std", "thin"], label="Mesh Initialization", value="std", visible=False)
|
57 |
setable_seed = gr.Slider(-1, 1000000000, -1, step=1, visible=True, label="Seed")
|
58 |
+
|
59 |
+
fullrunv2_btn = gr.Button('Generate 3D', interactive=True, variant="primary")
|
60 |
+
|
61 |
+
|
62 |
+
# Outputs
|
63 |
+
with gr.Column(scale=1):
|
64 |
+
# export mesh display
|
65 |
+
output_mesh = gr.Model3D(value=None, label="Mesh Model", show_label=True, height=320)
|
66 |
+
output_video = gr.Video(label="Preview", show_label=True, show_share_button=True, height=320, visible=False)
|
67 |
render_video = gr.Checkbox(value=False, visible=False, label="generate video")
|
68 |
+
|
69 |
+
example_folder = os.path.join(os.path.dirname(__file__), "./examples")
|
70 |
+
example_fns = sorted([os.path.join(example_folder, example) for example in os.listdir(example_folder)])
|
71 |
+
gr.Examples(
|
72 |
+
examples=example_fns,
|
73 |
+
inputs=[input_image],
|
74 |
+
cache_examples=False,
|
75 |
+
label='Examples',
|
76 |
+
examples_per_page=12
|
77 |
+
)
|
78 |
|
79 |
fullrunv2_btn.click(
|
80 |
fn = generate3dv2,
|