han-byeol commited on
Commit
cc7bbe2
1 Parent(s): bbc0f2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- labels_text = [labels_list[label] for label in np.unique(seg)]
80
- return ", ".join(labels_text)
 
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)