Spaces:
Runtime error
Runtime error
File size: 652 Bytes
b38a82c d37c147 b38a82c 03b5a35 b38a82c d37c147 03b5a35 d37c147 03b5a35 b38a82c 03b5a35 b38a82c 03b5a35 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from PIL import Image
import torch
from diffusers import StableDiffusionUpscalePipeline
# UltraSharpV2
model_id = "Kim2091/UltraSharpV2"
device = "cuda" if torch.cuda.is_available() else "cpu"
pipe = StableDiffusionUpscalePipeline.from_pretrained(model_id)
pipe = pipe.to(device)
def enhance_image(image: Image.Image) -> Image.Image:
return pipe(image).images[0]
demo = gr.Interface(
fn=enhance_image,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="UltraSharpV2 Enhancer",
description="Enhances and upscales images (faces, objects, text).",
allow_flagging="never"
)
demo.launch()
|