Files changed (1) hide show
  1. app.py +40 -8
app.py CHANGED
@@ -36,11 +36,14 @@ import gradio as gr
36
  from functools import partial
37
 
38
  import pdb
39
-
40
  import matplotlib.pyplot as plt
41
 
42
  from skimage import exposure
43
 
 
 
 
 
44
  cdl_color_map = [{'value': 1, 'label': 'Natural vegetation', 'rgb': (233,255,190)},
45
  {'value': 2, 'label': 'Forest', 'rgb': (149,206,147)},
46
  {'value': 3, 'label': 'Corn', 'rgb': (255,212,0)},
@@ -242,6 +245,22 @@ custom_test_pipeline=process_test_pipeline(model.cfg.data.test.pipeline, None)
242
 
243
  func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline)
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  with gr.Blocks() as demo:
246
 
247
  gr.Markdown(value='# Prithvi multi temporal crop classification')
@@ -253,16 +272,29 @@ with gr.Blocks() as demo:
253
  inp = gr.File()
254
  btn = gr.Button("Submit")
255
 
256
- with gr.Row():
257
- inp1=gr.Image(image_mode='RGB', scale=10, label='T1')
258
- inp2=gr.Image(image_mode='RGB', scale=10, label='T2')
259
- inp3=gr.Image(image_mode='RGB', scale=10, label='T3')
260
- out = gr.Image(image_mode='RGB', scale=10, label='Model prediction')
261
- # gr.Image(value='Legend.png', image_mode='RGB', scale=2, show_label=False)
262
 
263
  btn.click(fn=func, inputs=inp, outputs=[inp1, inp2, inp3, out])
264
-
265
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  with gr.Column():
267
  gr.Markdown(value='### Model prediction legend')
268
  gr.Image(value='Legend.png', image_mode='RGB', show_label=False)
 
36
  from functools import partial
37
 
38
  import pdb
 
39
  import matplotlib.pyplot as plt
40
 
41
  from skimage import exposure
42
 
43
+ import pandas as pd
44
+ from vega_datasets import data
45
+
46
+
47
  cdl_color_map = [{'value': 1, 'label': 'Natural vegetation', 'rgb': (233,255,190)},
48
  {'value': 2, 'label': 'Forest', 'rgb': (149,206,147)},
49
  {'value': 3, 'label': 'Corn', 'rgb': (255,212,0)},
 
245
 
246
  func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline)
247
 
248
+
249
+ stocks = data.stocks()
250
+ gapminder = data.gapminder()
251
+ gapminder = gapminder.loc[
252
+ gapminder.country.isin(["Argentina", "Australia", "Afghanistan"])
253
+ ]
254
+ climate = data.climate()
255
+ seattle_weather = data.seattle_weather()
256
+
257
+ simple = pd.DataFrame(
258
+ {
259
+ "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"],
260
+ "b": [28, 55, 43, 91, 81, 53, 19, 87, 52],
261
+ }
262
+ )
263
+
264
  with gr.Blocks() as demo:
265
 
266
  gr.Markdown(value='# Prithvi multi temporal crop classification')
 
272
  inp = gr.File()
273
  btn = gr.Button("Submit")
274
 
275
+ with gr.Column():
276
+ inp1=gr.Image(image_mode='RGB', scale=10, label='T1')
277
+ inp2=gr.Image(image_mode='RGB', scale=10, label='T2')
278
+ inp3=gr.Image(image_mode='RGB', scale=10, label='T3')
279
+ out = gr.Image(image_mode='RGB', scale=10, label='Model prediction')
280
+ # gr.Image(value='Legend.png', image_mode='RGB', scale=2, show_label=False)
281
 
282
  btn.click(fn=func, inputs=inp, outputs=[inp1, inp2, inp3, out])
283
+
284
  with gr.Row():
285
+ with gr.Column():
286
+ with gr.Row():
287
+ gr.BarPlot(simple,
288
+ x="a",
289
+ y="b",
290
+ title="Simple Bar Plot with made up data",
291
+ tooltip=["a", "b"],
292
+ y_lim=[20, 100],)
293
+ with gr.Row():
294
+ gr.LinePlot(simple,
295
+ x='a',
296
+ y='b')
297
+
298
  with gr.Column():
299
  gr.Markdown(value='### Model prediction legend')
300
  gr.Image(value='Legend.png', image_mode='RGB', show_label=False)