Ignaciobfp commited on
Commit
0ff8391
·
1 Parent(s): 0be59d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -229,7 +229,7 @@ def process_single_image(single_image_path, base_f, pro_f, rsw_f, rsd_f):
229
  pt = recombine_windows(rsw_f,rsd_f)
230
  shutil.rmtree(pro_f)
231
  shutil.rmtree(rsw_f)
232
- copiar_info_georref(single_image_path, pt)
233
  return pt
234
 
235
  # from osgeo import gdal, osr
@@ -291,6 +291,16 @@ def predict(img):
291
  mask[mask==1]=255
292
  mask=np.reshape(mask,(400,400))
293
  return Image.fromarray(mask.astype('uint8'))
 
 
 
 
 
 
 
 
 
 
294
 
295
  # Creamos la interfaz y la lanzamos.
296
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(400, 400)), outputs=gr.outputs.Image(type="pil"), examples=['examples/1CA SUR_1200_800.png', 'examples/1CA SUR_4000_1200.png', 'examples/1CA SUR_4800_2000.png']).launch(share=False)
 
229
  pt = recombine_windows(rsw_f,rsd_f)
230
  shutil.rmtree(pro_f)
231
  shutil.rmtree(rsw_f)
232
+ #copiar_info_georref(single_image_path, pt)
233
  return pt
234
 
235
  # from osgeo import gdal, osr
 
291
  mask[mask==1]=255
292
  mask=np.reshape(mask,(400,400))
293
  return Image.fromarray(mask.astype('uint8'))
294
+
295
+ def predict_full(img):
296
+ single_image_path = "tmp.tif"
297
+ base_f = "."
298
+ pro_f = "processing"
299
+ rsw_f = "results_windows"
300
+ rsd_f = "results_together"
301
+ destpath = process_single_image(single_image_path, base_f, pro_f, rsw_f, rsd_f)
302
+ im = Image.open(destpath)
303
+ return im
304
 
305
  # Creamos la interfaz y la lanzamos.
306
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(400, 400)), outputs=gr.outputs.Image(type="pil"), examples=['examples/1CA SUR_1200_800.png', 'examples/1CA SUR_4000_1200.png', 'examples/1CA SUR_4800_2000.png']).launch(share=False)