File size: 626 Bytes
948896c
70eb5ba
948896c
70eb5ba
 
c7a28d2
70eb5ba
948896c
70eb5ba
 
948896c
 
 
70eb5ba
 
 
 
 
 
 
 
 
948896c
0e698b0
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
import gradio as gr
from transformers import pipeline

# Load Stable Diffusion model from Hugging Face
generator = pipeline("text-to-image", model="stabilityai/stable-diffusion-3-medium-diffusers")

# Define the chatbot function
def generate_image(prompt: str):
    # Generate the image from the prompt
    image = generator(prompt)[0]["image"]
    return image

# Create the Gradio interface
iface = gr.Interface(
    fn=generate_image, 
    inputs=gr.Textbox(label="Enter a description of the image"), 
    outputs=gr.Image(label="Generated Image"),
    live=True
)

# Launch the Gradio interface
iface.launch(share=True)