Spaces:
Runtime error
Runtime error
Download app.py from joan772/FREEGPT: direct link, hf CLI and curl.
- Browser
- Download file 731 Bytes
-
https://huggingface.co/spaces/joan772/FREEGPT/resolve/main/app.py
- Command line
-
hf download hf://spaces/joan772/FREEGPT/app.py
-
curl -L -o app.py https://huggingface.co/spaces/joan772/FREEGPT/resolve/main/app.py
731 Bytes
| 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() | |