Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
9dd1448
1
Parent(s):
7e70aa4
invert mask and UI update
Browse files- app.py +11 -0
- inference.py +1 -1
app.py
CHANGED
@@ -97,6 +97,7 @@ with block:
|
|
97 |
[input_image, prompt_image, point_coords, point_labels, point_label_radio, text, pred_masks],
|
98 |
[prompt_image, lbl_image, point_coords, point_labels, pred_masks], queue=False)
|
99 |
|
|
|
100 |
def on_everything_image_select(input_image, pred_masks, masks, text, evt: gr.SelectData):
|
101 |
i = evt.index
|
102 |
mask = pred_masks[i][0]
|
@@ -109,6 +110,16 @@ with block:
|
|
109 |
lbl_image.select(on_everything_image_select,
|
110 |
[input_image, pred_masks, masks, text],
|
111 |
[masks, selected_masks_image], queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
#prompt_lbl_image.select(on_everything_image_select,
|
113 |
# [input_image, prompt_masks, masks, text],
|
114 |
# [masks, selected_masks_image], queue=False)
|
|
|
97 |
[input_image, prompt_image, point_coords, point_labels, point_label_radio, text, pred_masks],
|
98 |
[prompt_image, lbl_image, point_coords, point_labels, pred_masks], queue=False)
|
99 |
|
100 |
+
|
101 |
def on_everything_image_select(input_image, pred_masks, masks, text, evt: gr.SelectData):
|
102 |
i = evt.index
|
103 |
mask = pred_masks[i][0]
|
|
|
110 |
lbl_image.select(on_everything_image_select,
|
111 |
[input_image, pred_masks, masks, text],
|
112 |
[masks, selected_masks_image], queue=False)
|
113 |
+
|
114 |
+
def on_selected_masks_image_select(input_image, masks, evt: gr.SelectData):
|
115 |
+
i = evt.index
|
116 |
+
del masks[i]
|
117 |
+
anno = (input_image, masks)
|
118 |
+
return [masks, anno]
|
119 |
+
|
120 |
+
selected_masks_image.select(on_selected_masks_image_select,
|
121 |
+
[input_image, masks],
|
122 |
+
[masks, selected_masks_image], queue=False)
|
123 |
#prompt_lbl_image.select(on_everything_image_select,
|
124 |
# [input_image, prompt_masks, masks, text],
|
125 |
# [masks, selected_masks_image], queue=False)
|
inference.py
CHANGED
@@ -64,7 +64,7 @@ class DepthPredictor:
|
|
64 |
formatted = 255 - (output * 255 / np.max(output)).astype('uint8')
|
65 |
|
66 |
#img = Image.fromarray(formatted)
|
67 |
-
return output
|
68 |
|
69 |
def generate_pcl(self, image):
|
70 |
print(np.array(image).shape)
|
|
|
64 |
formatted = 255 - (output * 255 / np.max(output)).astype('uint8')
|
65 |
|
66 |
#img = Image.fromarray(formatted)
|
67 |
+
return 1 - output
|
68 |
|
69 |
def generate_pcl(self, image):
|
70 |
print(np.array(image).shape)
|