Spaces:
Runtime error
Runtime error
Download app.py from sprklinginfo/TextSummarizer: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/spaces/sprklinginfo/TextSummarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/sprklinginfo/TextSummarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sprklinginfo/TextSummarizer/resolve/main/app.py
672 Bytes
| import torch | |
| import gradio as gr | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| text_summarize = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| def summary(input_text): | |
| output_text = text_summarize(input_text) | |
| return output_text[0]['summary_text'] | |
| gr.close_all() | |
| # demo = gr.Interface(fn=summary, inputs="text", outputs="text") | |
| demo = gr.Interface(fn=summary, | |
| inputs=[gr.Textbox(label="Input text to summarize", lines=10)], | |
| outputs=[gr.Textbox(label="Summarized text", lines=5)]) | |
| demo.launch() | |