Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from PIL import Image | |
| from huggingface_hub import InferenceClient | |
| import io | |
| # Stable AI upscaler model | |
| client = InferenceClient( | |
| model="caidas/swin2SR-classical-sr-x2-64" | |
| ) | |
| def upscale_image(img): | |
| img = img.convert("RGB") | |
| buffer = io.BytesIO() | |
| img.save(buffer, format="PNG") | |
| # REAL HF inference call (correct method) | |
| result = client.image_to_image(buffer.getvalue()) | |
| return Image.open(io.BytesIO(result)) | |
| demo = gr.Interface( | |
| fn=upscale_image, | |
| inputs=gr.Image(type="pil"), | |
| outputs=gr.Image(), | |
| title="AI Upscaler" | |
| ) | |
| demo.launch() |