world_chart / app.py
Sanjayraju30's picture
Update app.py
68924be verified
raw
history blame
582 Bytes
import torch
import gradio as gr
from diffusers import StableDiffusionPipeline
model_id = "runwayml/stable-diffusion-v1-5" # You can change to your own model
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
def generate(prompt):
image = pipe(prompt).images[0]
return image
gr.Interface(
fn=generate,
inputs=gr.Textbox(label="Enter your prompt"),
outputs=gr.Image(type="pil"),
title="🎨 AI Image Generator",
description="Enter a prompt to generate images using Stable Diffusion",
).launch()