Spaces:
Runtime error
Runtime error
Commit
·
df6d6c1
1
Parent(s):
7830bee
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,41 +105,24 @@ def process_image(img):
|
|
| 105 |
return (lowres, preds)
|
| 106 |
|
| 107 |
image = gr.inputs.Image()
|
| 108 |
-
image_out = gr.outputs.Image()
|
| 109 |
|
| 110 |
markdown_part = """
|
| 111 |
|
| 112 |
-
|
| 113 |
|
| 114 |
-
Paper Link - https://arxiv.org/pdf/1707.02921
|
| 115 |
-
|
| 116 |
-
Keras Example link - https://keras.io/examples/vision/edsr/
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
TODO:
|
| 120 |
-
|
| 121 |
-
Hack to make this work for any image size. Currently the model takes input of image size 150 x 150.
|
| 122 |
-
|
| 123 |
-
We pad the input image with transparent pixels so that it is a square image, which is a multiple of 150 x 150
|
| 124 |
-
|
| 125 |
-
Then we chop the image into multiple 150 x 150 sub images
|
| 126 |
-
|
| 127 |
-
Upscale it and stitch it together.
|
| 128 |
-
|
| 129 |
-
The output image might look a bit off, because each sub-image dosent have data about other sub-images.
|
| 130 |
-
|
| 131 |
-
This approach assumes that the subimage has enough data about its surroundings
|
| 132 |
"""
|
| 133 |
|
| 134 |
-
|
| 135 |
|
| 136 |
gr.Interface(
|
| 137 |
process_image,
|
| 138 |
title="EDSR - Enhanced Deep Residual Networks for Single Image Super-Resolution",
|
| 139 |
description="SuperResolution",
|
| 140 |
inputs = image,
|
| 141 |
-
|
|
|
|
| 142 |
article = markdown_part,
|
| 143 |
interpretation='default',
|
| 144 |
allow_flagging='never'
|
| 145 |
-
).launch()
|
|
|
|
| 105 |
return (lowres, preds)
|
| 106 |
|
| 107 |
image = gr.inputs.Image()
|
| 108 |
+
#image_out = gr.outputs.Image()
|
| 109 |
|
| 110 |
markdown_part = """
|
| 111 |
|
| 112 |
+
Model Link - https://huggingface.co/keras-io/EDSR
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
"""
|
| 115 |
|
| 116 |
+
examples = [["./examples/1.png"]]
|
| 117 |
|
| 118 |
gr.Interface(
|
| 119 |
process_image,
|
| 120 |
title="EDSR - Enhanced Deep Residual Networks for Single Image Super-Resolution",
|
| 121 |
description="SuperResolution",
|
| 122 |
inputs = image,
|
| 123 |
+
examples = examples,
|
| 124 |
+
outputs = gr.Gallery(label="Outputs, First image is low res, next one is High Res",visible=True).style(grid=[2], height="auto"),
|
| 125 |
article = markdown_part,
|
| 126 |
interpretation='default',
|
| 127 |
allow_flagging='never'
|
| 128 |
+
).launch(debug=True)
|