Commit
·
43db0df
1
Parent(s):
7b76a8c
reverting to spinners
Browse files
app.py
CHANGED
@@ -48,17 +48,11 @@ if raw_image is not None:
|
|
48 |
# Second, apply argmax on the class dimension
|
49 |
seg = upsampled_logits.argmax(dim=1)[0]
|
50 |
color_seg = np.zeros((seg.shape[0], seg.shape[1], 3), dtype=np.uint8) # height, width, 3\
|
51 |
-
predicted_labels = []
|
52 |
for label, color in enumerate(palette):
|
53 |
color_seg[seg == label, :] = color
|
54 |
-
predicted_labels.append(label)
|
55 |
# Convert to BGR
|
56 |
color_seg = color_seg[..., ::-1]
|
57 |
# Show image + mask
|
58 |
img = np.array(image) * 0.5 + color_seg * 0.5
|
59 |
img = img.astype(np.uint8)
|
60 |
-
st.image(img, caption="Segmented Image")
|
61 |
-
|
62 |
-
st.header('Predicted Labels')
|
63 |
-
for idx, label in enumerate(predicted_labels):
|
64 |
-
st.subheader(f'{idx+1}) {label}')
|
|
|
48 |
# Second, apply argmax on the class dimension
|
49 |
seg = upsampled_logits.argmax(dim=1)[0]
|
50 |
color_seg = np.zeros((seg.shape[0], seg.shape[1], 3), dtype=np.uint8) # height, width, 3\
|
|
|
51 |
for label, color in enumerate(palette):
|
52 |
color_seg[seg == label, :] = color
|
|
|
53 |
# Convert to BGR
|
54 |
color_seg = color_seg[..., ::-1]
|
55 |
# Show image + mask
|
56 |
img = np.array(image) * 0.5 + color_seg * 0.5
|
57 |
img = img.astype(np.uint8)
|
58 |
+
st.image(img, caption="Segmented Image")
|
|
|
|
|
|
|
|