Spaces:
Runtime error
Runtime error
Download app.py from maxhorstmann/tldr: direct link, hf CLI and curl.
- Browser
- Download file 480 Bytes
-
https://huggingface.co/spaces/maxhorstmann/tldr/resolve/main/app.py
- Command line
-
hf download hf://spaces/maxhorstmann/tldr/app.py
-
curl -L -o app.py https://huggingface.co/spaces/maxhorstmann/tldr/resolve/main/app.py
480 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load models once | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| def summarize(text): | |
| summary = summarizer(text, max_length=60, min_length=15, do_sample=False)[0]["summary_text"] | |
| return summary | |
| iface = gr.Interface( | |
| fn=summarize, | |
| inputs=[ | |
| gr.Textbox(label="Enter Text", lines=20), | |
| ], | |
| outputs=gr.Textbox(label="TL;DR"), | |
| title="TL;DR Generator" | |
| ) | |
| iface.launch() | |