Spaces:
Build error
Build error
import gradio as gr | |
import torch | |
from PIL import Image | |
from realesrgan import RealESRGAN | |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
# ุญู ูู ุงููู ูุฐุฌ ููุฒูู (ูููุฒููู ุชููุงุฆูุงู ุฃูู ู ุฑุฉ) | |
model = RealESRGAN(device, scale=4) | |
model.load_weights("RealESRGAN_x4plus.pth", download=True) | |
def upscale(img: Image.Image) -> Image.Image: | |
return model.predict(img) | |
demo = gr.Interface( | |
fn=upscale, | |
inputs=gr.Image(type="pil", label="Upload image"), | |
outputs=gr.Image(type="pil", label="Upscaled ร4"), | |
title="Upscayl-Web", | |
description="Open-source image upscaler powered by Real-ESRGAN (ร4).", | |
) | |
if __name__ == "__main__": | |
demo.launch(server_name="0.0.0.0", server_port=7860) |