Spaces:
Runtime error
Runtime error
Commit
·
3486847
1
Parent(s):
a55243d
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
def upscale_image(input_image, radio_input):
|
| 6 |
+
upscale_factor = radio_input
|
| 7 |
+
output_image = cv2.resize(input_image, None, fx = upscale_factor, fy = upscale_factor, interpolation = cv2.INTER_CUBIC)
|
| 8 |
+
return output_image
|
| 9 |
+
|
| 10 |
+
DESCRIPTION = """
|
| 11 |
+
Try our free online image upscaler tool, capable of upscaling images by 400% and up to 16000x16000 resolution.
|
| 12 |
+
|
| 13 |
+
⚠️ Enlarging the image and "Upscale Level" do not always improve image quality! 😥
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
radio_input = gr.Radio(label="Upscale Levels", choices=[2, 4, 6, 8, 10, 12], value=2)
|
| 17 |
+
|
| 18 |
+
iface = gr.Interface(fn=upscale_image, inputs = [gr.Image(label="Input Image", interactive=True), radio_input], outputs = gr.Image(label="Upscaled Image"), title="Image Upscaler", description=DESCRIPTION)
|
| 19 |
+
iface.launch(show_api=False)
|