File size: 617 Bytes
57581a7
96e258e
09edb9e
96e258e
d8dc65a
 
96e258e
b926bb5
 
 
 
96e258e
 
 
b926bb5
 
d8dc65a
 
96e258e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from PIL import Image
from transformers import pipeline

# Swin2SR super resolution model (x4 upscale)
sr = pipeline("image-to-image", model="caidas/swin2SR-classical-sr-x4-64")

def enhance(image: Image.Image):
    results = sr(image)
    enhanced_img = results[0]["generated_image"]
    return enhanced_img

iface = gr.Interface(
    fn=enhance,
    inputs=gr.Image(type="pil", label="Upload Photo"),
    outputs=gr.Image(type="pil", label="Enhanced Photo"),
    title="AI Photo Enhancer",
    description="Upload your photo and get an enhanced version (Super Resolution x4)."
)

iface.launch()