Download app.py from TomCallan/summary: direct link, hf CLI and curl.
- Browser
- Download file 314 Bytes
-
https://huggingface.co/spaces/TomCallan/summary/resolve/main/app.py
- Command line
-
hf download hf://spaces/TomCallan/summary/app.py
-
curl -L -o app.py https://huggingface.co/spaces/TomCallan/summary/resolve/main/app.py
314 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| def f(x): | |
| return summarizer(x, max_length=160, min_length=40, do_sample=False)[0]['summary_text'] | |
| iface = gr.Interface(fn=f, inputs="text", outputs="text") | |
| iface.launch(share=True) |