Download App.py from SpicyHam/Grad1: direct link, hf CLI and curl.
- Browser
- Download file 324 Bytes
-
https://huggingface.co/spaces/SpicyHam/Grad1/resolve/main/App.py
- Command line
-
hf download hf://spaces/SpicyHam/Grad1/App.py
-
curl -L -o App.py https://huggingface.co/spaces/SpicyHam/Grad1/resolve/main/App.py
324 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize a text generation model | |
| generator = pipeline("text-generation", model="gpt2") | |
| def generate_text(prompt): | |
| return generator(prompt, max_length=50)[0]["generated_text"] | |
| iface = gr.Interface(fn=generate_text, inputs="text", outputs="text") | |
| iface.launch() |