initial commit
Browse files- app.py +9 -5
- examples/example1_x2.jpg +0 -0
- examples/example_1.png +0 -0
- examples/example_2.png +0 -0
- examples/example_3.png +0 -0
- examples/example_4.png +0 -0
- examples/example_5.png +0 -0
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -36,7 +36,7 @@ def convert_pil_to_cv2(image):
|
|
| 36 |
return open_cv_image
|
| 37 |
|
| 38 |
|
| 39 |
-
def
|
| 40 |
model_path = "models/model.ort"
|
| 41 |
img = convert_pil_to_cv2(image)
|
| 42 |
if img.ndim == 2:
|
|
@@ -59,12 +59,16 @@ def main(image):
|
|
| 59 |
return image_output
|
| 60 |
|
| 61 |
|
|
|
|
|
|
|
|
|
|
| 62 |
gr.Interface(
|
| 63 |
-
|
| 64 |
-
gr.inputs.Image(type="pil"),
|
| 65 |
-
"image",
|
|
|
|
| 66 |
title="Image Upscaling 🦆",
|
| 67 |
allow_flagging="never",
|
| 68 |
-
css=
|
| 69 |
).launch()
|
| 70 |
|
|
|
|
| 36 |
return open_cv_image
|
| 37 |
|
| 38 |
|
| 39 |
+
def upscale(image):
|
| 40 |
model_path = "models/model.ort"
|
| 41 |
img = convert_pil_to_cv2(image)
|
| 42 |
if img.ndim == 2:
|
|
|
|
| 59 |
return image_output
|
| 60 |
|
| 61 |
|
| 62 |
+
examples = [f"examples/example_{i+1}.png" for i in range(5)]
|
| 63 |
+
css = ".output-image, .input-image, .image-preview {height: 480px !important} "
|
| 64 |
+
|
| 65 |
gr.Interface(
|
| 66 |
+
fn=upscale,
|
| 67 |
+
inputs=gr.inputs.Image(type="pil"),
|
| 68 |
+
outputs="image",
|
| 69 |
+
examples=examples,
|
| 70 |
title="Image Upscaling 🦆",
|
| 71 |
allow_flagging="never",
|
| 72 |
+
css=css,
|
| 73 |
).launch()
|
| 74 |
|
examples/example1_x2.jpg
DELETED
|
Binary file (38 kB)
|
|
|
examples/example_1.png
ADDED
|
examples/example_2.png
ADDED
|
examples/example_3.png
ADDED
|
examples/example_4.png
ADDED
|
examples/example_5.png
ADDED
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
numpy
|
| 2 |
-
onnxruntime
|
| 3 |
opencv-python-headless
|
|
|
|
| 1 |
numpy
|
| 2 |
+
onnxruntime-gpu
|
| 3 |
opencv-python-headless
|