Spaces:
Runtime error
Runtime error
File size: 591 Bytes
65dbe60 |
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 transformers import pipeline
# Load the model for image generation
generator = pipeline('text-to-image', model='CompVis/stable-diffusion-v1-4', device=0) # Use your model here
def generate_image(description):
# Generate image from description
image = generator(description)[0]
return image
# Create the Gradio interface
iface = gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
live=True,
description="Enter a description to generate an image (e.g., 'A boy holding a bag')"
)
# Launch the interface
iface.launch()
|