Download app.py from cforge42/basic: direct link, hf CLI and curl.
- Browser
- Download file 740 Bytes
-
https://huggingface.co/spaces/cforge42/basic/resolve/4d7123e61e798d5b63752f0afe287d101cd39708/app.py
- Command line
-
hf download hf://spaces/cforge42/basic@4d7123e61e798d5b63752f0afe287d101cd39708/app.py
-
curl -L -o app.py https://huggingface.co/spaces/cforge42/basic/resolve/4d7123e61e798d5b63752f0afe287d101cd39708/app.py
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() | |