Spaces:
Runtime error
Runtime error
Download app.py from afreedd/image-super-resolution: direct link, hf CLI and curl.
- Browser
- Download file 531 Bytes
-
https://huggingface.co/spaces/afreedd/image-super-resolution/resolve/main/app.py
- Command line
-
hf download hf://spaces/afreedd/image-super-resolution/app.py
-
curl -L -o app.py https://huggingface.co/spaces/afreedd/image-super-resolution/resolve/main/app.py
531 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| from PIL import Image | |
| import torch | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| pipe = pipeline(task="image-to-image", model="caidas/swin2SR-lightweight-x2-64", device=device) | |
| def upscale_image(image): | |
| upscaled = pipe(image) | |
| return upscaled | |
| iface = gr.Interface( | |
| fn=upscale_image, | |
| inputs=gr.Image(type="pil"), | |
| outputs=gr.Image(type="pil"), | |
| title="Image Super Resolution", | |
| description="Upscale an image using Swin2SR." | |
| ) | |
| iface.launch() |