Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -328,7 +328,13 @@ def get_mesh(image, depth, blur_data, loadall, dcolor):
|
|
328 |
glb_file = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
|
329 |
scene.export(glb_file.name)
|
330 |
print('file - ok')
|
331 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
|
333 |
def blur_image(image, depth, blur_data):
|
334 |
blur_a = blur_data.split()
|
@@ -628,8 +634,9 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
628 |
submit = gr.Button("Submit")
|
629 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
|
630 |
output_switch = gr.Checkbox(label="Show depths")
|
631 |
-
optimize_switch = gr.Checkbox(label="Optimize")
|
632 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
|
|
|
|
633 |
optimize_switch.input(fn=optimize, inputs=[optimize_switch, output_switch], outputs=[output_frame, bgcolor])
|
634 |
output_mask = gr.ImageEditor(layers=False, sources=('upload', 'clipboard'), show_download_button=True, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
635 |
with gr.Row():
|
@@ -934,7 +941,6 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
934 |
]"""
|
935 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
936 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
937 |
-
bgcolor = gr.Textbox(elem_id="bgcolor", value="[127, 127, 127, 255]", label="Background color", interactive=False)
|
938 |
|
939 |
result_file = gr.File(label="3D file (.glb)")
|
940 |
result_file.change(fn=None, inputs=[result_file, coords, mesh_order, bgcolor], outputs=None, js=load_model)
|
|
|
328 |
glb_file = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
|
329 |
scene.export(glb_file.name)
|
330 |
print('file - ok')
|
331 |
+
|
332 |
+
dcolor = json.loads(dcolor)
|
333 |
+
j = 0
|
334 |
+
while j < len(dcolor):
|
335 |
+
dcolor[j] = dcolor[j] / 255
|
336 |
+
j=j+1
|
337 |
+
return gr.Model3D(value=glb_file.name, clear_color=dcolor), glb_file.name, ",".join(mesh_n)
|
338 |
|
339 |
def blur_image(image, depth, blur_data):
|
340 |
blur_a = blur_data.split()
|
|
|
634 |
submit = gr.Button("Submit")
|
635 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
|
636 |
output_switch = gr.Checkbox(label="Show depths")
|
|
|
637 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
638 |
+
optimize_switch = gr.Checkbox(label="Optimize")
|
639 |
+
bgcolor = gr.Textbox(elem_id="bgcolor", value="[127, 127, 127, 255]", label="Background color", interactive=False)
|
640 |
optimize_switch.input(fn=optimize, inputs=[optimize_switch, output_switch], outputs=[output_frame, bgcolor])
|
641 |
output_mask = gr.ImageEditor(layers=False, sources=('upload', 'clipboard'), show_download_button=True, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
642 |
with gr.Row():
|
|
|
941 |
]"""
|
942 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
943 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
|
|
944 |
|
945 |
result_file = gr.File(label="3D file (.glb)")
|
946 |
result_file.change(fn=None, inputs=[result_file, coords, mesh_order, bgcolor], outputs=None, js=load_model)
|