Spaces:
Runtime error
Runtime error
File size: 683 Bytes
1a42e96 d7c4592 1a42e96 d7c4592 1a42e96 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from diffusers import DiffusionPipeline
# Load the Stable Diffusion pipeline
pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v-1-4")
def generate_image(prompt):
# Generate the image from the prompt
image = pipe(prompt).images[0]
return image
# Create a Gradio interface
iface = gr.Interface(
fn=generate_image,
inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g. Astronaut in a jungle"),
outputs=gr.Image(label="Generated Image"),
title="Stable Diffusion Image Generator",
description="Generate images using Stable Diffusion based on your prompts."
)
if __name__ == "__main__":
iface.launch()
|