Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import torch | |
| from diffusers import StableDiffusionPipeline | |
| from PIL import Image | |
| # Model load karna | |
| model_id = "nitrosocke/Ghibli-Diffusion" | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) | |
| pipe.to("cuda" if torch.cuda.is_available() else "cpu") | |
| def convert_to_ghibli(image): | |
| prompt = "A Studio Ghibli-style anime painting" | |
| ghibli_image = pipe(prompt, image=image).images[0] | |
| return ghibli_image | |
| # Gradio Web App | |
| interface = gr.Interface( | |
| fn=convert_to_ghibli, | |
| inputs=gr.Image(type="pil"), | |
| outputs="image", | |
| title="β¨ Ghibli AI Converter π¨", | |
| description="Upload an image and get a Studio Ghibli-style version of it!" | |
| ) | |
| interface.launch() | |