Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -93,6 +93,15 @@ def load_model():
|
|
93 |
|
94 |
return model, processor, device
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
### SERVER ###
|
97 |
def server(input: Inputs, output: Outputs, session: Session):
|
98 |
|
|
|
93 |
|
94 |
return model, processor, device
|
95 |
|
96 |
+
def show_mask(mask, ax, random_color=False):
|
97 |
+
if random_color:
|
98 |
+
color = np.concatenate([np.random.random(3), np.array([0.6])], axis=0)
|
99 |
+
else:
|
100 |
+
color = np.array([30/255, 144/255, 255/255, 0.6])
|
101 |
+
h, w = mask.shape[-2:]
|
102 |
+
mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
|
103 |
+
ax.imshow(mask_image)
|
104 |
+
|
105 |
### SERVER ###
|
106 |
def server(input: Inputs, output: Outputs, session: Session):
|
107 |
|