dbuscombe commited on
Commit
9506988
1 Parent(s): fdc72db
.gitattributes CHANGED
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ examples/*.* filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
7
+ import gradio as gr
8
+
9
+ model = from_pretrained_keras("keras-io/super-resolution")
10
+ 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)
18
+ y = y.astype("float32") / 255.0
19
+
20
+ input = np.expand_dims(y, axis=0)
21
+ out = model.predict(input)
22
+
23
+ out_img_y = out[0]
24
+ out_img_y *= 255.0
25
+
26
+ # Restore the image in RGB color space.
27
+ out_img_y = out_img_y.clip(0, 255)
28
+ out_img_y = out_img_y.reshape((np.shape(out_img_y)[0], np.shape(out_img_y)[1]))
29
+ out_img_y = Image.fromarray(np.uint8(out_img_y), mode="L")
30
+ out_img_cb = cb.resize(out_img_y.size, Image.BICUBIC)
31
+ out_img_cr = cr.resize(out_img_y.size, Image.BICUBIC)
32
+ out_img = Image.merge("YCbCr", (out_img_y, out_img_cb, out_img_cr)).convert(
33
+ "RGB"
34
+ )
35
+ return (img,out_img)
36
+
37
+ 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> <center>Contributors: <a href='https://twitter.com/Cr0wley_zz'>Devjyoti Chakraborty</a>|<a href='https://twitter.com/ritwik_raha'>Ritwik Raha</a>|<a href='https://twitter.com/ariG23498'>Aritra Roy Gosthipaty</a></center>"
38
+
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()
examples/2000-04-28-18-21-24_L5_rgb.jpg ADDED

Git LFS Details

  • SHA256: 9819ce0b66d6c5926a75f93e6cfa025be0f4b06a4ce09ad1cbfa72b3b108d96d
  • Pointer size: 130 Bytes
  • Size of remote file: 60.7 kB
examples/2000-08-02-18-23-18_L5_rgb.jpg ADDED

Git LFS Details

  • SHA256: c80154e60ba5d6210868fbe1984c5ccdae7d33725e538f5c7442e82f3a17ab48
  • Pointer size: 130 Bytes
  • Size of remote file: 72.5 kB
examples/2000-08-18-18-23-46_L5_rgb.jpg ADDED

Git LFS Details

  • SHA256: 3c888e9e1b4cda58d593d212456072ad1afa1ecefcba036fc9250a3788b18f15
  • Pointer size: 130 Bytes
  • Size of remote file: 72.7 kB
examples/2000-09-19-18-24-18_L5_rgb.jpg ADDED

Git LFS Details

  • SHA256: 67585d15d2db6a8e2d4925ad557996b72e7490bd4aa2bc36c0b171a4b63109ea
  • Pointer size: 130 Bytes
  • Size of remote file: 60 kB
examples/2000-10-21-18-24-43_L5_rgb.jpg ADDED

Git LFS Details

  • SHA256: 45f363db3d4860fbe3b0d93799586980af017f6dbe7bb2b0fd9acad47902cbd6
  • Pointer size: 130 Bytes
  • Size of remote file: 59.6 kB
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ scikit-image
2
+ numpy
3
+ tensorflow