dbuscombe commited on
Commit
e113be6
1 Parent(s): b76d559
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -42,21 +42,23 @@ def infer(image):
42
  "RGB"
43
  )
44
 
 
 
45
  out = {}
46
- out.update( {'input image size': (nx,ny) } )
47
- out.update( {'output image size': (nxo,nyo) } )
 
 
48
 
49
- return (pd.DataFrame(data=out.values(), index=out.keys()).transpose(), img,out_img)
50
 
51
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1609.05158' target='_blank'>Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network</a></p><center> <a href='https://keras.io/examples/vision/super_resolution_sub_pixel/' target='_blank'>Image Super-Resolution using an Efficient Sub-Pixel CNN</a></p>"
52
 
53
- # examples = [['examples/2000-04-28-18-21-24_L5_rgb.jpg'],['examples/2000-08-02-18-23-18_L5_rgb.jpg'],
54
- # ['examples/2000-08-18-18-23-46_L5_rgb.jpg'],['examples/2000-09-19-18-24-18_L5_rgb.jpg'],['examples/2000-10-21-18-24-43_L5_rgb.jpg']]
55
-
56
  examples= [[l] for l in glob('examples/tiles/*.jpg')]
57
- out1 = gr.outputs.Dataframe(label='Summary', headers=["Input (px)", "Output (px)"], type='pandas')
58
  out2 = gr.outputs.Image(label="Cropped input image", type='pil')
59
  out3 = gr.outputs.Image(label="Super-resolution x3 image", type='pil')
 
60
 
61
  iface = gr.Interface(
62
  fn=infer,
@@ -64,6 +66,6 @@ iface = gr.Interface(
64
  description = "This space is a demo of Satellite image Super-Resolution using a Sub-Pixel Convolutional Neural Network",
65
  article = article,
66
  inputs=gr.inputs.Image(label="Input Image"),
67
- outputs=[out1,out2,out3],
68
  examples=examples,
69
  ).launch()
 
42
  "RGB"
43
  )
44
 
45
+ out_img.save('output.png')
46
+
47
  out = {}
48
+ out.update( {'input image size x': nx } )
49
+ out.update( {'output image size x': nxo } )
50
+ out.update( {'input image size y': ny } )
51
+ out.update( {'output image size y': nyo } )
52
 
53
+ return (pd.DataFrame(data=out.values(), index=out.keys()).transpose(), img,out_img, 'output.png')
54
 
55
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1609.05158' target='_blank'>Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network</a></p><center> <a href='https://keras.io/examples/vision/super_resolution_sub_pixel/' target='_blank'>Image Super-Resolution using an Efficient Sub-Pixel CNN</a></p>"
56
 
 
 
 
57
  examples= [[l] for l in glob('examples/tiles/*.jpg')]
58
+ out1 = gr.outputs.Dataframe(label='Summary', headers=["Input X (px)", "Output X (px)", "Input Y (px)", "Output Y (px)"], type='pandas')
59
  out2 = gr.outputs.Image(label="Cropped input image", type='pil')
60
  out3 = gr.outputs.Image(label="Super-resolution x3 image", type='pil')
61
+ out4 = gr.outputs.File(label='Click to download super-resolved image')
62
 
63
  iface = gr.Interface(
64
  fn=infer,
 
66
  description = "This space is a demo of Satellite image Super-Resolution using a Sub-Pixel Convolutional Neural Network",
67
  article = article,
68
  inputs=gr.inputs.Image(label="Input Image"),
69
+ outputs=[out1,out2,out3,out4],
70
  examples=examples,
71
  ).launch()