Update app.py
Browse files
app.py
CHANGED
|
@@ -166,7 +166,6 @@ def remove_bg(fl, s, l, v):
|
|
| 166 |
|
| 167 |
#remove regions of low saturation and lightness (get scene without shadow)
|
| 168 |
m = cv2.inRange(cv2.cvtColor(frame_c, cv2.COLOR_RGB2HSV), np.array([0,0,0]), np.array([180,s,l]))
|
| 169 |
-
print(v)
|
| 170 |
mask = cv2.inRange(blur_s, 0, v)
|
| 171 |
masks = np.bitwise_and(m, mask)
|
| 172 |
frame[masks>0] = (127,127,127)
|
|
@@ -294,10 +293,10 @@ with gr.Blocks() as demo:
|
|
| 294 |
files_input = gr.File(file_count="multiple", file_types=['image', '.mp4'])
|
| 295 |
gallery_input = gr.Gallery(label="Slideshow", preview=True, columns=8192, interactive=False)
|
| 296 |
with gr.Accordion(label="Background removal settings", open=False):
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
files_input.upload(fn=loadf, inputs=[files_input, max_s, max_l, max_v], outputs=[files_input, gallery_input])
|
| 302 |
with gr.Row():
|
| 303 |
interpolation_slider = gr.Slider(minimum=1, maximum=5, step=1, value=1, label="Interpolation Steps: ")
|
|
|
|
| 166 |
|
| 167 |
#remove regions of low saturation and lightness (get scene without shadow)
|
| 168 |
m = cv2.inRange(cv2.cvtColor(frame_c, cv2.COLOR_RGB2HSV), np.array([0,0,0]), np.array([180,s,l]))
|
|
|
|
| 169 |
mask = cv2.inRange(blur_s, 0, v)
|
| 170 |
masks = np.bitwise_and(m, mask)
|
| 171 |
frame[masks>0] = (127,127,127)
|
|
|
|
| 293 |
files_input = gr.File(file_count="multiple", file_types=['image', '.mp4'])
|
| 294 |
gallery_input = gr.Gallery(label="Slideshow", preview=True, columns=8192, interactive=False)
|
| 295 |
with gr.Accordion(label="Background removal settings", open=False):
|
| 296 |
+
with gr.Column(label="Shadow maximums"):
|
| 297 |
+
max_s = gr.Slider(minimum=0, maximum=255, step=1, value=32, label="Saturation")
|
| 298 |
+
max_l = gr.Slider(minimum=0, maximum=255, step=1, value=64, label="Lightness")
|
| 299 |
+
max_v = gr.Slider(minimum=0, maximum=255, step=1, value=16, label="Variance")
|
| 300 |
files_input.upload(fn=loadf, inputs=[files_input, max_s, max_l, max_v], outputs=[files_input, gallery_input])
|
| 301 |
with gr.Row():
|
| 302 |
interpolation_slider = gr.Slider(minimum=1, maximum=5, step=1, value=1, label="Interpolation Steps: ")
|