Spaces:
Build error
Build error
Download app.py from AIROBOHUB/TextSummarizer: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/AIROBOHUB/TextSummarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/AIROBOHUB/TextSummarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AIROBOHUB/TextSummarizer/resolve/main/app.py
1.23 kB
| import torch | |
| import gradio as gr | |
| #use pipeline as a high-level helper | |
| from transformers import pipeline, Pipeline | |
| text_summary = pipeline(task="summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16) | |
| # model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots" | |
| # "/a4f8f3ea906ed274767e9906dbaede7531d660ff") | |
| # text_summary = pipeline(task="summarization", model=model_path, | |
| # 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="text", outputs="text", title="AI ROBO HUB Consulting Services Pvt. Ltd.", description="This AI App is used to SUMMARIZE THE GIVEN TEXT - +91 7893688993 | chrao@airobohub.com") | |
| demo=gr.Interface(fn=summary, | |
| inputs=[gr.Textbox(label="Input Text for Summary", lines=6)], | |
| outputs=[gr.Textbox(label="Summarized Text",lines=6)], | |
| title="AI ROBO HUB Consulting Services Pvt. Ltd.", | |
| description="This AI App is used to SUMMARIZE THE GIVEN TEXT - It's POC, Accepts limited input text. - +91 7893688993 | chrao@airobohub.com") | |
| demo.launch() |