dbuscombe commited on
Commit
6f608dd
β€’
1 Parent(s): 9506988
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import tensorflow as tf
2
  import numpy as np
3
  from PIL import Image
 
4
 
5
  from tensorflow.keras.preprocessing.image import img_to_array
6
  from huggingface_hub import from_pretrained_keras
@@ -11,7 +12,8 @@ model.summary()
11
 
12
  def infer(image):
13
  img = Image.fromarray(image)
14
- img = img.resize((100,100))
 
15
  ycbcr = img.convert("YCbCr")
16
  y, cb, cr = ycbcr.split()
17
  y = img_to_array(y)
@@ -39,14 +41,16 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1609.051
39
  examples = [['examples/2000-04-28-18-21-24_L5_rgb.jpg'],['examples/2000-08-02-18-23-18_L5_rgb.jpg'],
40
  ['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']]
41
 
 
 
42
  iface = gr.Interface(
43
  fn=infer,
44
  title = " Satellite Super-resolution",
45
  description = "This space is a demo of the keras tutorial 'Image Super-Resolution using an Efficient Sub-Pixel CNN' based on the paper 'Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network' πŸ‘€",
46
  article = article,
47
  inputs=gr.inputs.Image(label="Input Image"),
48
- outputs=[gr.outputs.Image(label="Resized 100x100 image"),
49
- gr.outputs.Image(label="Super-resolution 300x300 image")
50
  ],
51
  examples=examples,
52
  ).launch()
 
1
  import tensorflow as tf
2
  import numpy as np
3
  from PIL import Image
4
+ from glob import glob
5
 
6
  from tensorflow.keras.preprocessing.image import img_to_array
7
  from huggingface_hub import from_pretrained_keras
 
12
 
13
  def infer(image):
14
  img = Image.fromarray(image)
15
+ # img = img.resize((100,100))
16
+ img = img.crop((0,100,0,100))
17
  ycbcr = img.convert("YCbCr")
18
  y, cb, cr = ycbcr.split()
19
  y = img_to_array(y)
 
41
  examples = [['examples/2000-04-28-18-21-24_L5_rgb.jpg'],['examples/2000-08-02-18-23-18_L5_rgb.jpg'],
42
  ['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']]
43
 
44
+ examples= [[l] for l in glob('examples/tiles/*.jpg')]
45
+
46
  iface = gr.Interface(
47
  fn=infer,
48
  title = " Satellite Super-resolution",
49
  description = "This space is a demo of the keras tutorial 'Image Super-Resolution using an Efficient Sub-Pixel CNN' based on the paper 'Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network' πŸ‘€",
50
  article = article,
51
  inputs=gr.inputs.Image(label="Input Image"),
52
+ outputs=[gr.outputs.Image(label="Cropped input image"),
53
+ gr.outputs.Image(label="Super-resolution x3 image")
54
  ],
55
  examples=examples,
56
  ).launch()
examples/tiles/2000-04-28-18-21-24_L5_rgb-0.jpg ADDED
examples/tiles/2000-04-28-18-21-24_L5_rgb-1.jpg ADDED
examples/tiles/2000-08-02-18-23-18_L5_rgb-0.jpg ADDED
examples/tiles/2000-08-02-18-23-18_L5_rgb-1.jpg ADDED
examples/tiles/2000-08-18-18-23-46_L5_rgb-0.jpg ADDED
examples/tiles/2000-08-18-18-23-46_L5_rgb-1.jpg ADDED
examples/tiles/2000-09-19-18-24-18_L5_rgb-0.jpg ADDED
examples/tiles/2000-09-19-18-24-18_L5_rgb-1.jpg ADDED
examples/tiles/2000-10-21-18-24-43_L5_rgb-0.jpg ADDED
examples/tiles/2000-10-21-18-24-43_L5_rgb-1.jpg ADDED