Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,8 @@ def image_objects(image):
|
|
| 24 |
pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
|
| 25 |
return gr.Dropdown.update(choices = pred_object_list, interactive = True)
|
| 26 |
|
|
|
|
|
|
|
| 27 |
def blurr_object(image, object, blur_strength):
|
| 28 |
image = img_resize(image)
|
| 29 |
|
|
@@ -45,7 +47,7 @@ def blurr_object(image, object, blur_strength):
|
|
| 45 |
blurred_output_image = Image.fromarray((blur_image_reverse_mask).astype(np.uint8)+segmented_image.astype(np.uint8))
|
| 46 |
for _ in range(int(blur_strength//2.5)):
|
| 47 |
blurred_output_image = blurred_output_image.filter(ImageFilter.SMOOTH_MORE)
|
| 48 |
-
return blurred_output_image
|
| 49 |
|
| 50 |
app = gr.Blocks()
|
| 51 |
|
|
@@ -85,7 +87,8 @@ with app:
|
|
| 85 |
### Blurred Image Output
|
| 86 |
""")
|
| 87 |
image_output = gr.Image()
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
image_input.change(fn=image_objects,
|
| 91 |
inputs=image_input,
|
|
@@ -94,7 +97,7 @@ with app:
|
|
| 94 |
|
| 95 |
object_output.change(fn=blurr_object,
|
| 96 |
inputs=[image_input, object_output, blur_slider],
|
| 97 |
-
outputs=image_output)
|
| 98 |
|
| 99 |
blur_slider.change(fn=blurr_object,
|
| 100 |
inputs=[image_input, object_output, blur_slider],
|
|
|
|
| 24 |
pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
|
| 25 |
return gr.Dropdown.update(choices = pred_object_list, interactive = True)
|
| 26 |
|
| 27 |
+
|
| 28 |
+
|
| 29 |
def blurr_object(image, object, blur_strength):
|
| 30 |
image = img_resize(image)
|
| 31 |
|
|
|
|
| 47 |
blurred_output_image = Image.fromarray((blur_image_reverse_mask).astype(np.uint8)+segmented_image.astype(np.uint8))
|
| 48 |
for _ in range(int(blur_strength//2.5)):
|
| 49 |
blurred_output_image = blurred_output_image.filter(ImageFilter.SMOOTH_MORE)
|
| 50 |
+
return blurred_output_image, segmented_image
|
| 51 |
|
| 52 |
app = gr.Blocks()
|
| 53 |
|
|
|
|
| 87 |
### Blurred Image Output
|
| 88 |
""")
|
| 89 |
image_output = gr.Image()
|
| 90 |
+
with gr.Column():
|
| 91 |
+
gal1=gr.Gallery()
|
| 92 |
|
| 93 |
image_input.change(fn=image_objects,
|
| 94 |
inputs=image_input,
|
|
|
|
| 97 |
|
| 98 |
object_output.change(fn=blurr_object,
|
| 99 |
inputs=[image_input, object_output, blur_slider],
|
| 100 |
+
outputs=image_output, gal1)
|
| 101 |
|
| 102 |
blur_slider.change(fn=blurr_object,
|
| 103 |
inputs=[image_input, object_output, blur_slider],
|