Spaces:
Runtime error
Runtime error
File size: 909 Bytes
51d44c9 553aeef 51d44c9 553aeef f0f2255 553aeef f0f2255 553aeef | 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 | import gradio as gr
from diffusers import StableDiffusionPipeline
# Load pre-trained model
model_id = "CompVis/stable-diffusion-v1-4"
pipe = StableDiffusionPipeline.from_pretrained(model_id)
def generate_image(prompt):
# Generate image from text prompt
images = pipe(prompt, num_images=1).images
return images[0]
# Define Gradio UI
iface = gr.Interface(
fn=generate_image,
inputs=gr.components.Textbox(lines=2, placeholder="Enter a text prompt here..."),
outputs=gr.components.Image(),
title="DreamBooth Image Generation",
description="Enter a text prompt to generate an image using DreamBooth.",
examples=[
["A cute 2D bear wearing glasses, in a cartoon style"],
["An adorable 2D cartoon bear with round glasses"],
["A kawaii 2D bear character wearing glasses, with a cute and whimsical style"]
]
)
# Launch the UI
iface.launch(share=True)
|