Summarization
Transformers
English
code
Summarizer
BART
Gradio
Machine Learning
Natural Language Processing (NLP)
Deep Learning
Interactive Demo
Python
AI
Instructions to use Dannyar608/Text_summarizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dannyar608/Text_summarizer with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="Dannyar608/Text_summarizer")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Dannyar608/Text_summarizer", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| !pip install transformers | |
| !pip install gradio | |
| import gradio as gr | |
| from transformers import pipeline | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| def summarize_text(text): | |
| summary = summarizer(text, max_length=200, min_length=100, do_sample=False) | |
| return summary[0]['summary_text'] | |
| demo = gr.Interface( | |
| fn=summarize_text, | |
| inputs=gr.Textbox(placeholder="Enter your text here", label="Input Text"), | |
| outputs=gr.Textbox(label="Summary"), | |
| title="Text Summarizer", | |
| description="This chatbot takes a long text as input and returns a summary." | |
| ) | |
| demo.launch() |