Spaces:
Sleeping
Sleeping
Download app.py from AIROBOHUB/TextSummary: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/AIROBOHUB/TextSummary/resolve/main/app.py
- Command line
-
hf download hf://spaces/AIROBOHUB/TextSummary/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AIROBOHUB/TextSummary/resolve/main/app.py
1.23 kB
| import torch | |
| import gradio as gr | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| # model_Path="../Models/models--sshleifer--distilbart-cnn-12-6/snapshots/a4f8f3ea906ed274767e9906dbaede7531d660ff" | |
| # text_summary = pipeline("summarization", model=model_Path) | |
| text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| # text="""William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist best known for | |
| # co-founding the software company Microsoft with his childhood friend Paul Allen. He later held the positions of chairman, | |
| # chief executive officer (CEO), president, and chief software architect of the company. Gates was also its largest individual | |
| # shareholder until May 2014.[a] He was a pioneer of the microcomputer revolution of the 1970s and 1980s.""" | |
| def summary(input): | |
| output = text_summary(input) | |
| return output[0]['summary_text'] | |
| ui_demo=gr.Interface( | |
| fn=summary, | |
| inputs=[gr.Textbox(label='Input text for Summary',lines=5)], | |
| outputs=[gr.Textbox(label='Summarized Text',lines=2)], | |
| title='TEXT SUMMARY', | |
| description='This app will take large text as input and generates summary and dispay' | |
| ) | |
| ui_demo.launch() |