Spaces:
Runtime error
Runtime error
msg
Browse files
app.py
CHANGED
@@ -11,6 +11,10 @@ model = from_pretrained_keras("keras-io/super-resolution")
|
|
11 |
model.summary()
|
12 |
|
13 |
def infer(image):
|
|
|
|
|
|
|
|
|
14 |
img = Image.fromarray(image)
|
15 |
# img = img.resize((100,100))
|
16 |
# img = img.crop((0,100,0,100))
|
@@ -22,6 +26,9 @@ def infer(image):
|
|
22 |
input = np.expand_dims(y, axis=0)
|
23 |
out = model.predict(input)
|
24 |
|
|
|
|
|
|
|
25 |
out_img_y = out[0]
|
26 |
out_img_y *= 255.0
|
27 |
|
@@ -34,12 +41,17 @@ def infer(image):
|
|
34 |
out_img = Image.merge("YCbCr", (out_img_y, out_img_cb, out_img_cr)).convert(
|
35 |
"RGB"
|
36 |
)
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
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>"
|
40 |
|
41 |
-
examples = [['examples/2000-04-28-18-21-24_L5_rgb.jpg'],['examples/2000-08-02-18-23-18_L5_rgb.jpg'],
|
42 |
-
|
43 |
|
44 |
examples= [[l] for l in glob('examples/tiles/*.jpg')]
|
45 |
|
|
|
11 |
model.summary()
|
12 |
|
13 |
def infer(image):
|
14 |
+
|
15 |
+
nx=image.shape[0]
|
16 |
+
ny=image.shape[1]
|
17 |
+
|
18 |
img = Image.fromarray(image)
|
19 |
# img = img.resize((100,100))
|
20 |
# img = img.crop((0,100,0,100))
|
|
|
26 |
input = np.expand_dims(y, axis=0)
|
27 |
out = model.predict(input)
|
28 |
|
29 |
+
nxo = out.squeeze().shape[0]
|
30 |
+
nyo = out.squeeze().shape[1]
|
31 |
+
|
32 |
out_img_y = out[0]
|
33 |
out_img_y *= 255.0
|
34 |
|
|
|
41 |
out_img = Image.merge("YCbCr", (out_img_y, out_img_cb, out_img_cr)).convert(
|
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> <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>"
|
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 |
|