Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -76,8 +76,9 @@ def draw_plot(pred_img, seg):
|
|
76 |
|
77 |
def segmentation_to_text(seg):
|
78 |
seg = seg.numpy()
|
79 |
-
|
80 |
-
|
|
|
81 |
|
82 |
def sepia(input_img):
|
83 |
input_img = Image.fromarray(input_img)
|
|
|
76 |
|
77 |
def segmentation_to_text(seg):
|
78 |
seg = seg.numpy()
|
79 |
+
unique_labels, counts = np.unique(seg, return_counts=True)
|
80 |
+
labels_text = [f"{labels_list[label]}: {count}" for label, count in zip(unique_labels, counts)]
|
81 |
+
return "\n".join(labels_text)
|
82 |
|
83 |
def sepia(input_img):
|
84 |
input_img = Image.fromarray(input_img)
|