File size: 731 Bytes
25a39e8
488c137
 
25a39e8
 
488c137
25a39e8
 
 
 
 
 
 
 
 
 
 
 
 
 
488c137
 
25a39e8
 
488c137
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
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()