File size: 860 Bytes
25a39e8
 
191bedf
25a39e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
!pip install gradio diffusers transformers accelerate torch torchvision


from diffusers import StableDiffusionPipeline
import torch
import gradio as gr
from PIL import Image

# Stable Diffusion ka Ghibli-style 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="Studio Ghibli Image Converter 🎨",
    description="Upload an image, and convert it to a Studio Ghibli-style artwork!",
)

interface.launch(share=True)