Guillermo Uribe Vicencio commited on
Commit
7a27404
·
1 Parent(s): d604d1b
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -60,11 +60,9 @@ cdl_color_map = [{'value': 1, 'label': 'Natural vegetation', 'rgb': (233,255,190
60
 
61
  def apply_color_map(rgb, color_map=cdl_color_map):
62
 
63
-
64
  rgb_mapped = rgb.copy()
65
 
66
  for map_tmp in cdl_color_map:
67
-
68
  for i in range(3):
69
  rgb_mapped[i] = np.where((rgb[0] == map_tmp['value']) & (rgb[1] == map_tmp['value']) & (rgb[2] == map_tmp['value']), map_tmp['rgb'][i], rgb_mapped[i])
70
 
@@ -158,7 +156,6 @@ def inference_segmentor(model, imgs, custom_test_pipeline=None):
158
  else:
159
  # img_metas = scatter(data['img_metas'],'cpu')
160
  # data['img_metas'] = [i.data[0] for i in data['img_metas']]
161
-
162
  img_metas = data['img_metas'].data[0]
163
  img = data['img']
164
  data = {'img': img, 'img_metas':img_metas}
@@ -274,8 +271,6 @@ with gr.Blocks() as demo:
274
  inp2=gr.Image(image_mode='RGB', scale=10, label='T2')
275
  inp3=gr.Image(image_mode='RGB', scale=10, label='T3')
276
 
277
- btn.click(fn=func, inputs=inp, outputs=[inp1, inp2, inp3, out])
278
-
279
  with gr.Row():
280
  with gr.Column():
281
  gr.BarPlot(simple,
@@ -291,6 +286,8 @@ with gr.Blocks() as demo:
291
  out = gr.Image(image_mode='RGB', scale=10, label='Model prediction')
292
  # gr.Image(value='Legend.png', image_mode='RGB', scale=2, show_label=False)
293
 
 
 
294
  with gr.Row():
295
  gr.Markdown(value='### Model prediction legend')
296
  gr.Image(value='Legend.png', image_mode='RGB', show_label=False)
 
60
 
61
  def apply_color_map(rgb, color_map=cdl_color_map):
62
 
 
63
  rgb_mapped = rgb.copy()
64
 
65
  for map_tmp in cdl_color_map:
 
66
  for i in range(3):
67
  rgb_mapped[i] = np.where((rgb[0] == map_tmp['value']) & (rgb[1] == map_tmp['value']) & (rgb[2] == map_tmp['value']), map_tmp['rgb'][i], rgb_mapped[i])
68
 
 
156
  else:
157
  # img_metas = scatter(data['img_metas'],'cpu')
158
  # data['img_metas'] = [i.data[0] for i in data['img_metas']]
 
159
  img_metas = data['img_metas'].data[0]
160
  img = data['img']
161
  data = {'img': img, 'img_metas':img_metas}
 
271
  inp2=gr.Image(image_mode='RGB', scale=10, label='T2')
272
  inp3=gr.Image(image_mode='RGB', scale=10, label='T3')
273
 
 
 
274
  with gr.Row():
275
  with gr.Column():
276
  gr.BarPlot(simple,
 
286
  out = gr.Image(image_mode='RGB', scale=10, label='Model prediction')
287
  # gr.Image(value='Legend.png', image_mode='RGB', scale=2, show_label=False)
288
 
289
+ btn.click(fn=func, inputs=inp, outputs=[inp1, inp2, inp3, out])
290
+
291
  with gr.Row():
292
  gr.Markdown(value='### Model prediction legend')
293
  gr.Image(value='Legend.png', image_mode='RGB', show_label=False)