File size: 784 Bytes
7c538d0
 
 
 
 
 
32bdcc8
7c538d0
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

# Load the Stable Diffusion model
pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
pipe = pipe.to("cpu")

# Define the image generation function
def generate_comic_image(prompt):
    image = pipe(prompt).images[0]
    return image

# Launch the Gradio interface
gr.Interface(
    fn=generate_comic_image,
    inputs=gr.Textbox(label="Describe your comic scene or character", placeholder="e.g. A futuristic bounty hunter with glowing eyes"),
    outputs=gr.Image(label="Generated Comic Image"),
    title="Timtical Comic Creator",
    description="Type a prompt to generate comic-style images using AI. Built with Stable Diffusion."
).launch()