Spaces:
Build error
Build error
Download app.py from Makima57/TextSummarizer: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/spaces/Makima57/TextSummarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/Makima57/TextSummarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Makima57/TextSummarizer/resolve/main/app.py
576 Bytes
| import torch | |
| import gradio as gr | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16) | |
| def summary(input): | |
| output = text_summary(input) | |
| return output[0]['summary_text'] | |
| gr.close_all() | |
| demo = gr.Interface(fn=summary, inputs=[gr.Textbox(label="Input Text to Summarize", lines=6)], outputs=[gr.Textbox(label="Summarized Text", lines=4)], title="Text Summarizer", description="This Application will be used to Summarize text") | |
| demo.launch() |