Spaces:
Build error
Build error
Download app.py from mesutdmn/Text-Summarizer: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/spaces/mesutdmn/Text-Summarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/mesutdmn/Text-Summarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mesutdmn/Text-Summarizer/resolve/main/app.py
607 Bytes
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| import gradio as gr | |
| import os | |
| pipe = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| def summarize(input): | |
| output = pipe(input) | |
| return output[0]['summary_text'] | |
| gr.close_all() | |
| demo = gr.Interface(fn=summarize, | |
| inputs=[gr.Textbox(label="Text to summarize", lines=10)], | |
| outputs=[gr.Textbox(label="Text to summarize", lines=5)], | |
| title="Text Summarization", | |
| description="Summarize any text using distilbart") | |
| demo.launch() |