basic / app.py
cforge42's picture
Update app.py
4d7123e verified
raw
history blame
740 Bytes
import gradio as gr
from transformers import pipeline
# Load the BigGAN model using the transformers 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."""
# The pipeline's output is an image.
image = generator(text_input)["images"][0]
return image
# Create the Gradio interface directly
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()