| import gradio as gr |
| from transformers import pipeline |
|
|
| |
| generator = pipeline("text-to-image", model="osanseviero/BigGAN-deep-128") |
|
|
| def generate_image(text_input): |
| """Generates an image from text using the BigGAN pipeline.""" |
| |
| image = generator(text_input)["images"][0] |
| return image |
|
|
| |
| interface = gr.Interface( |
| fn=generate_image, |
| inputs=gr.Textbox(label="Enter a prompt"), |
| outputs=gr.Image(label="Generated Image"), |
| title="BigGAN ImageNet", |
| description="BigGAN text-to-image demo.", |
| examples=[["american robin"], ["ocean sunset"], ["cat in a hat"]] |
| ) |
|
|
| interface.launch() |
|
|