AIEnhanced / app.py
MrEmam's picture
Update app.py
d8dc65a verified
raw
history blame contribute delete
617 Bytes
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()