Spaces:
Sleeping
Sleeping
| 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() | |