Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -359,7 +359,8 @@ def apply_mask(d):
|
|
359 |
global masks
|
360 |
|
361 |
masks[frame_selected] = d["background"]
|
362 |
-
|
|
|
363 |
|
364 |
def draw_mask(l, c, k, v, d, evt: gr.EventData):
|
365 |
global params
|
@@ -489,7 +490,7 @@ with gr.Blocks(css=css) as demo:
|
|
489 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
|
490 |
output_switch = gr.Checkbox(label="Show depths")
|
491 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
492 |
-
output_mask = gr.ImageEditor(layers=False, sources=
|
493 |
depth_file = gr.File(label="Edited depth")
|
494 |
output_mask.apply(fn=apply_mask, inputs=[output_mask], outputs=[output_mask, depth_file])
|
495 |
with gr.Accordion(label="Edge", open=False):
|
|
|
359 |
global masks
|
360 |
|
361 |
masks[frame_selected] = d["background"]
|
362 |
+
cv2.imwrite(f"f{frame_selected}_dmap.png", masks[frame_selected])
|
363 |
+
return masks[frame_selected], f"f{frame_selected}_dmap.png"
|
364 |
|
365 |
def draw_mask(l, c, k, v, d, evt: gr.EventData):
|
366 |
global params
|
|
|
490 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
|
491 |
output_switch = gr.Checkbox(label="Show depths")
|
492 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
493 |
+
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")
|
494 |
depth_file = gr.File(label="Edited depth")
|
495 |
output_mask.apply(fn=apply_mask, inputs=[output_mask], outputs=[output_mask, depth_file])
|
496 |
with gr.Accordion(label="Edge", open=False):
|