vrk05 commited on
Commit
23c49b8
Β·
1 Parent(s): 7a1e92f
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  from huggingface_hub import hf_hub_download
3
- config_path=hf_hub_download(repo_id="ibm-nasa-geospatial/Prithvi-100M-sen1floods11", filename="sen1floods11_Prithvi_100M.py", token=os.environ.get("token"))
4
  ckpt=hf_hub_download(repo_id="vrk05/Flooding_IBM", filename='floods_fine.pth', token=os.environ.get("token"))
5
 
6
  import argparse
@@ -33,7 +33,6 @@ import matplotlib.pyplot as plt
33
 
34
  from skimage import exposure
35
 
36
-
37
  def stretch_rgb(rgb):
38
 
39
  ls_pct=1
@@ -51,7 +50,6 @@ def open_tiff(fname):
51
 
52
  return data
53
 
54
-
55
  def write_tiff(img_wrt, filename, metadata):
56
 
57
  """
@@ -72,7 +70,7 @@ def write_tiff(img_wrt, filename, metadata):
72
  dest.write(img_wrt[i, :, :], i + 1)
73
 
74
  return filename
75
-
76
 
77
  def get_meta(fname):
78
 
@@ -129,6 +127,7 @@ def inference_segmentor(model, imgs, custom_test_pipeline=None):
129
  result = model(return_loss=False, rescale=True, **data)
130
  return result
131
 
 
132
  def inference_on_file(target_image, model, custom_test_pipeline):
133
 
134
  target_image = target_image.name
@@ -208,7 +207,9 @@ with gr.Blocks() as demo:
208
  btn.click(fn=func, inputs=inp, outputs=[out1, out2])
209
 
210
  with gr.Row():
211
- gr.Examples(examples=["Spain_7370579_S2Hand.tif"],
 
 
212
  inputs=inp,
213
  outputs=[out1, out2],
214
  preprocess=preprocess_example,
@@ -216,4 +217,4 @@ with gr.Blocks() as demo:
216
  cache_examples=True,
217
  )
218
 
219
- demo.launch()
 
1
  import os
2
  from huggingface_hub import hf_hub_download
3
+ config_path=hf_hub_download(repo_id="vrk05/Flooding_IBM", filename="floods_fine.pth", token=os.environ.get("token"))
4
  ckpt=hf_hub_download(repo_id="vrk05/Flooding_IBM", filename='floods_fine.pth', token=os.environ.get("token"))
5
 
6
  import argparse
 
33
 
34
  from skimage import exposure
35
 
 
36
  def stretch_rgb(rgb):
37
 
38
  ls_pct=1
 
50
 
51
  return data
52
 
 
53
  def write_tiff(img_wrt, filename, metadata):
54
 
55
  """
 
70
  dest.write(img_wrt[i, :, :], i + 1)
71
 
72
  return filename
73
+
74
 
75
  def get_meta(fname):
76
 
 
127
  result = model(return_loss=False, rescale=True, **data)
128
  return result
129
 
130
+
131
  def inference_on_file(target_image, model, custom_test_pipeline):
132
 
133
  target_image = target_image.name
 
207
  btn.click(fn=func, inputs=inp, outputs=[out1, out2])
208
 
209
  with gr.Row():
210
+ gr.Examples(examples=["India_900498_S2Hand.tif",
211
+ "Spain_7370579_S2Hand.tif",
212
+ "USA_430764_S2Hand.tif"],
213
  inputs=inp,
214
  outputs=[out1, out2],
215
  preprocess=preprocess_example,
 
217
  cache_examples=True,
218
  )
219
 
220
+ demo.launch()