Spaces:
Runtime error
Runtime error
Commit
·
5bdcaaf
1
Parent(s):
5b6c473
Update app.py
Browse files
app.py
CHANGED
@@ -95,6 +95,7 @@ def render_segmentation(segmentation_logits, dataset):
|
|
95 |
colormap_array = np.array(colormap, dtype=np.uint8)
|
96 |
segmentation_logits += 1
|
97 |
segmentation_values = colormap_array[segmentation_logits]
|
|
|
98 |
unique_labels = np.unique(segmentation_logits)
|
99 |
|
100 |
colormap_array = colormap_array[unique_labels]
|
@@ -106,7 +107,7 @@ def render_segmentation(segmentation_logits, dataset):
|
|
106 |
for idx, color in enumerate(colormap_array):
|
107 |
color_box = np.zeros((20, 20, 3), dtype=np.uint8)
|
108 |
color_box[:, :] = color
|
109 |
-
color_box = cv2.cvtColor(color_box, cv2.COLOR_RGB2BGR)
|
110 |
_, img_data = cv2.imencode(".jpg", color_box)
|
111 |
img_base64 = base64.b64encode(img_data).decode("utf-8")
|
112 |
img_data_uri = f"data:image/jpg;base64,{img_base64}"
|
|
|
95 |
colormap_array = np.array(colormap, dtype=np.uint8)
|
96 |
segmentation_logits += 1
|
97 |
segmentation_values = colormap_array[segmentation_logits]
|
98 |
+
segmentation_values = segmentation_values[:, :, ::-1]
|
99 |
unique_labels = np.unique(segmentation_logits)
|
100 |
|
101 |
colormap_array = colormap_array[unique_labels]
|
|
|
107 |
for idx, color in enumerate(colormap_array):
|
108 |
color_box = np.zeros((20, 20, 3), dtype=np.uint8)
|
109 |
color_box[:, :] = color
|
110 |
+
# color_box = cv2.cvtColor(color_box, cv2.COLOR_RGB2BGR)
|
111 |
_, img_data = cv2.imencode(".jpg", color_box)
|
112 |
img_base64 = base64.b64encode(img_data).decode("utf-8")
|
113 |
img_data_uri = f"data:image/jpg;base64,{img_base64}"
|