Text Summarizer is a Streamlit web application that uses the BART (Bidirectional and Auto-Regressive Transformers) model to generate concise summaries of long texts. It supports both direct text input and PDF file uploads.
- Summarize text input directly
- Summarize content from uploaded PDF files
- Uses the state-of-the-art BART model for high-quality summaries
- User-friendly interface built with Streamlit
- Python 3.7+
- Streamlit
- PyTorch
- Transformers (Hugging Face)
- PyPDF2
-
Clone this repository:
git clone https://github.com/yourusername/text-summarizer.git cd text-summarizer
-
Install the required packages:
pip install -r requirements.txt
Note: Make sure to create a
requirements.txt
file with the following content:streamlit torch transformers PyPDF2
-
Run the Streamlit app:
streamlit run app.py
-
Open your web browser and go to
http://localhost:8501
. -
Choose your input method:
- "Enter Text": Type or paste your text directly into the text area.
- "Upload PDF": Upload a PDF file to summarize its content.
-
Click the "Summarize" button to generate the summary.
- The app uses the BART model (
facebook/bart-large-cnn
) for text summarization. - For PDF inputs, it extracts text using PyPDF2 before summarization.
- The model generates a summary with a maximum length of 150 tokens and a minimum length of 50 tokens.
You can adjust the summarization parameters in the summarize_text
function:
max_length
: Maximum length of the generated summary (default: 150)min_length
: Minimum length of the generated summary (default: 50)
Contributions are welcome! Please feel free to submit a Pull Request.