Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,16 +46,15 @@ def run_segmentation_wrapper(image):
|
|
| 46 |
print("!!", len(mask_np_list))
|
| 47 |
max_val = len(mask_np_list)-1
|
| 48 |
sliderup = gr.Slider(value = 0, minimum=0, maximum=max_val, step=1, visible=True)
|
|
|
|
| 49 |
return image, segmentation, mask_np_list, mask_label_list, image, sliderup, sliderup , 'Segmentation finish. Select mask id and move to the next step.'
|
| 50 |
except:
|
| 51 |
sliderup = gr.Slider(value = 0, minimum=0, maximum=1, step=1, visible=False)
|
|
|
|
| 52 |
return None,None,None,None,None, sliderup, sliderup , 'Please upload an image before proceeding.'
|
| 53 |
|
| 54 |
|
| 55 |
def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
|
| 56 |
-
print(type(backimg))
|
| 57 |
-
print(type(foreimg))
|
| 58 |
-
print(type(mask_np))
|
| 59 |
backimg_solid_np = np.array(backimg)
|
| 60 |
bimg = backimg.copy()
|
| 61 |
fimg = foreimg.copy()
|
|
@@ -308,6 +307,7 @@ with gr.Blocks() as demo:
|
|
| 308 |
tgt_index = int(tgt_index)
|
| 309 |
)
|
| 310 |
run_edit_text()
|
|
|
|
| 311 |
return load_pil_img()
|
| 312 |
|
| 313 |
|
|
|
|
| 46 |
print("!!", len(mask_np_list))
|
| 47 |
max_val = len(mask_np_list)-1
|
| 48 |
sliderup = gr.Slider(value = 0, minimum=0, maximum=max_val, step=1, visible=True)
|
| 49 |
+
gr.Info('Segmentation finish. Select mask id and move to the next step.')
|
| 50 |
return image, segmentation, mask_np_list, mask_label_list, image, sliderup, sliderup , 'Segmentation finish. Select mask id and move to the next step.'
|
| 51 |
except:
|
| 52 |
sliderup = gr.Slider(value = 0, minimum=0, maximum=1, step=1, visible=False)
|
| 53 |
+
gr.Warning('Please upload an image before proceeding.')
|
| 54 |
return None,None,None,None,None, sliderup, sliderup , 'Please upload an image before proceeding.'
|
| 55 |
|
| 56 |
|
| 57 |
def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
|
|
|
|
|
|
|
|
|
|
| 58 |
backimg_solid_np = np.array(backimg)
|
| 59 |
bimg = backimg.copy()
|
| 60 |
fimg = foreimg.copy()
|
|
|
|
| 307 |
tgt_index = int(tgt_index)
|
| 308 |
)
|
| 309 |
run_edit_text()
|
| 310 |
+
gr.Info('Image edit finish.')
|
| 311 |
return load_pil_img()
|
| 312 |
|
| 313 |
|