Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import numpy as np
|
| 5 |
|
| 6 |
+
@spaces.GPU
|
| 7 |
+
def upscale(image):
|
| 8 |
+
img = Image.fromarray(image)
|
| 9 |
|
| 10 |
+
img = img.resize(
|
| 11 |
+
(img.width * 2, img.height * 2),
|
| 12 |
+
Image.LANCZOS
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
return np.array(img)
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
fn=upscale,
|
| 19 |
+
inputs=gr.Image(type="numpy"),
|
| 20 |
+
outputs=gr.Image(type="numpy"),
|
| 21 |
+
title="Upscale Alpha Test"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
demo.launch()
|