hyo37009 commited on
Commit
4c72fc5
·
1 Parent(s): 634ef86
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -91,8 +91,8 @@ def label_to_color_image(label):
91
  if label.ndim != 2:
92
  raise ValueError("Expect 2-D input label")
93
 
94
- if np.max(label) >= len(colormap):
95
- raise ValueError("label value too large.")
96
  return colormap[label]
97
 
98
  iface = gr.Interface(
 
91
  if label.ndim != 2:
92
  raise ValueError("Expect 2-D input label")
93
 
94
+ # Clip label values to be within the range of colormap
95
+ label = np.clip(label, 0, len(colormap) - 1)
96
  return colormap[label]
97
 
98
  iface = gr.Interface(