Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -354,6 +354,13 @@ def switch_rows(v):
|
|
354 |
print(frames[0])
|
355 |
return frames
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
def draw_mask(f, l, c, k, v, d, evt: gr.EventData):
|
358 |
global params
|
359 |
global frame_selected
|
@@ -483,6 +490,7 @@ with gr.Blocks(css=css) as demo:
|
|
483 |
output_switch = gr.Checkbox(label="Show depths")
|
484 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
485 |
output_mask = gr.ImageEditor(layers=False, sources=None, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
|
|
486 |
with gr.Accordion(label="Edge", open=False):
|
487 |
gradients = gr.Files(visible=False, value=['./gradient_large.png', './gradient.png', './gradient_small.png'])
|
488 |
levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
|
|
|
354 |
print(frames[0])
|
355 |
return frames
|
356 |
|
357 |
+
def apply_mask(d):
|
358 |
+
global frame_selected
|
359 |
+
global masks
|
360 |
+
|
361 |
+
masks[frame_selected] = d["background"]
|
362 |
+
return masks[frame_selected]
|
363 |
+
|
364 |
def draw_mask(f, l, c, k, v, d, evt: gr.EventData):
|
365 |
global params
|
366 |
global frame_selected
|
|
|
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=None, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
493 |
+
output_mask.apply(fn=apply_mask, inputs=[output_mask], outputs=[output_mask])
|
494 |
with gr.Accordion(label="Edge", open=False):
|
495 |
gradients = gr.Files(visible=False, value=['./gradient_large.png', './gradient.png', './gradient_small.png'])
|
496 |
levels = gr.Slider(label="Color levels", value=16, maximum=32, minimum=2, step=1)
|