Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,13 +39,17 @@ def create_segmentation(mask_np_list):
|
|
| 39 |
|
| 40 |
|
| 41 |
def run_segmentation_wrapper(image):
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
def run_segmentation_wrapper(image):
|
| 42 |
+
try:
|
| 43 |
+
image, mask_np_list,mask_label_list = run_segmentation(image)
|
| 44 |
+
#image = image.convert('RGB')
|
| 45 |
+
segmentation = create_segmentation(mask_np_list)
|
| 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=max_val, 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):
|