Spaces:
Running
on
Zero
Running
on
Zero
basic app
Browse files
README.md
CHANGED
|
@@ -10,4 +10,4 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at <https://huggingface.co/docs/hub/spaces-config-reference>
|
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from gradio_imageslider import ImageSlider
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
with gr.Blocks() as demo:
|
|
|
|
| 5 |
with gr.Row():
|
| 6 |
with gr.Column():
|
| 7 |
input_image = gr.Image(type="pil", label="Input Image")
|
|
@@ -14,4 +31,11 @@ with gr.Blocks() as demo:
|
|
| 14 |
position=0.1,
|
| 15 |
)
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
from gradio_imageslider import ImageSlider
|
| 4 |
+
from image_gen_aux import UpscaleWithModel
|
| 5 |
+
from image_gen_aux.utils import load_image
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@spaces.GPU
|
| 9 |
+
def upscale_image(image):
|
| 10 |
+
original = load_image(image)
|
| 11 |
+
|
| 12 |
+
upscaler = UpscaleWithModel.from_pretrained("OzzyGT/UltraSharp").to("cuda")
|
| 13 |
+
image = upscaler(original)
|
| 14 |
+
|
| 15 |
+
return original, image
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
title = """<h1 align="center">Image Upscaler</h1>"""
|
| 19 |
|
| 20 |
with gr.Blocks() as demo:
|
| 21 |
+
gr.HTML(title)
|
| 22 |
with gr.Row():
|
| 23 |
with gr.Column():
|
| 24 |
input_image = gr.Image(type="pil", label="Input Image")
|
|
|
|
| 31 |
position=0.1,
|
| 32 |
)
|
| 33 |
|
| 34 |
+
run_button.click(
|
| 35 |
+
fn=upscale_image,
|
| 36 |
+
inputs=[input_image],
|
| 37 |
+
outputs=result,
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
demo.launch(share=False)
|