Paste any article. Get a sharp, accurate summary in seconds.
Powered by state-of-the-art NLP β completely free, runs locally.
π Live Demo β Β Β |Β Β π API Docs Β Β |Β Β π Report a Bug
- About the Project
- Features
- Live Demo
- Tech Stack
- Project Structure
- Getting Started
- API Reference
- How It Works
- Running Tests
- Roadmap
- Contributing
- License
- Author
SummarAI is a full-stack web application that uses Natural Language Processing (NLP) to automatically summarize long-form text β articles, research papers, blog posts, news β into concise, readable summaries.
The project implements two distinct summarization approaches:
- Abstractive β uses the
facebook/bart-large-cnntransformer model (fine-tuned on 300,000+ CNN/DailyMail articles) to understand the text and write a fresh summary in its own words, just like a human would. - Extractive β uses a custom-built TF-IDF scoring algorithm to identify and return the most statistically important sentences from the original text.
This was built as a beginner-to-intermediate learning project to understand NLP pipelines, REST API design, and full-stack web development β from model inference all the way to a production-ready interface.
| Feature | Description |
|---|---|
| π§ Abstractive Summarization | facebook/bart-large-cnn rewrites text in its own words β natural, human-sounding output |
| βοΈ Extractive Summarization | Custom TF-IDF engine selects the most important original sentences |
| π 3 Summary Lengths | Short, Medium, Long β control exactly how detailed the output is |
| π Live Statistics | Compression ratio, word counts, and method used β shown after every summary |
| π One-Click Copy | Copy the generated summary to clipboard instantly |
| π― Built-in Sample Article | Demo article included β works immediately with no setup |
| π Clean REST API | JSON API with 3 endpoints β can be integrated into any app |
| π― 100% Free & Local | No paid APIs, no subscriptions, no data sent to the cloud |
π The app is deployed and accessible here:
https://summari-84uc.onrender.com
β οΈ Note: The app runs on Render's free tier β it may take 30β60 seconds to wake up on first visit.
| Layer | Technology | Why |
|---|---|---|
| Frontend | HTML5, CSS3, Vanilla JavaScript | Lightweight, no framework overhead |
| Backend | Python 3.10, Flask 3.0 | Simple, fast REST API server |
| AI Model | HuggingFace Transformers + BART | State-of-the-art abstractive summarization |
| NLP Algorithm | Custom TF-IDF (no libraries) | Fast extractive summarization, zero dependencies |
| Deployment | Render | Free cloud hosting for Python apps |
| Testing | pytest | Unit + integration test coverage |
Text-Summarizer-Tool/
β
βββ π backend/
β βββ app.py # Flask app β all API routes and server config
β βββ summarizer.py # Core NLP engine (BART abstractive + TF-IDF extractive)
β
βββ π frontend/
β βββ templates/
β β βββ index.html # Main UI β single page app
β βββ static/
β βββ css/
β β βββ style.css # Dark editorial theme, fully responsive
β βββ js/
β βββ main.js # UI logic, API calls, state management
β
βββ π tests/
β βββ test_summarizer.py # 15 unit + integration tests (pytest)
β
βββ π docs/
β βββ API.md # Full API endpoint reference
β
βββ requirements.txt # All Python dependencies with pinned versions
βββ .gitignore # Excludes venv, cache, model files from Git
βββ LICENSE # MIT License
βββ README.md # This file
- Python 3.10 or higher β Download
- pip (bundled with Python)
- ~2GB free disk space (for the BART model cache)
- Git β Download
1. Clone the repository
git clone https://github.com/TUSHARTAMRAKAR/Text-Summarizer-Tool.git
cd Text-Summarizer-Tool2. Create a virtual environment
python -m venv venv3. Activate the virtual environment
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activateYou'll see (venv) at the start of your terminal prompt. β
4. Install dependencies
pip install -r requirements.txt
β οΈ The first run will download thefacebook/bart-large-cnnmodel (~1.6GB).
This only happens once β it's cached locally afterwards.
5. Start the server
cd backend
python app.py6. Open in browser
http://localhost:5000
The app is running. π
Full documentation β docs/API.md
Base URL: http://localhost:5000
Summarize a piece of text.
Request body:
{
"text": "Paste your article text here...",
"length": "medium",
"method": "abstractive"
}| Parameter | Type | Options | Default |
|---|---|---|---|
text |
string |
50 β 50,000 characters | required |
length |
string |
short Β· medium Β· long |
medium |
method |
string |
abstractive Β· extractive |
abstractive |
Success response 200:
{
"success": true,
"summary": "Artificial intelligence is reshaping industries worldwide...",
"original_word_count": 500,
"summary_word_count": 82,
"compression_ratio": "84%",
"method_used": "abstractive"
}Error response 400:
{
"success": false,
"error": "Text is too short. Please provide at least 50 characters."
}Returns server and model status.
{
"status": "healthy",
"model_loaded": true,
"version": "1.0.0"
}Returns a built-in demo article for testing.
Your Text
β
BART Encoder β Reads and builds deep understanding of the text
β
BART Decoder β Generates a brand new summary, word by word
β
Fresh Summary (written in the model's own words)
BART (Bidirectional and Auto-Regressive Transformer) was fine-tuned by Facebook AI on the CNN/DailyMail dataset β 300,000+ news articles with human-written summaries. It learns to compress information the same way a journalist would.
Your Text
β
Split into individual sentences
β
Score each sentence using TF-IDF weights
(words rare in the document but frequent in the sentence = more important)
β
Rank sentences by score
β
Return top N sentences in original order
TF-IDF = Term Frequency Γ Inverse Document Frequency. It mathematically identifies which words β and therefore which sentences β carry the most unique information in the document. No AI model needed, works fully offline, instant results.
# From project root with venv active
python -m pytest tests/ -vExpected output:
tests/test_summarizer.py::TestExtractive::test_extractive_returns_dict PASSED
tests/test_summarizer.py::TestExtractive::test_extractive_success_flag PASSED
tests/test_summarizer.py::TestExtractive::test_extractive_has_summary PASSED
tests/test_summarizer.py::TestExtractive::test_extractive_method_label PASSED
tests/test_summarizer.py::TestExtractive::test_extractive_word_counts PASSED
tests/test_summarizer.py::TestExtractive::test_extractive_short_length PASSED
tests/test_summarizer.py::TestWordCounting::test_compression_ratio PASSED
tests/test_summarizer.py::TestEdgeCases::test_handles_multiline_text PASSED
tests/test_summarizer.py::TestEdgeCases::test_all_length_options PASSED
tests/test_summarizer.py::TestAPIEndpoints::test_health_endpoint PASSED
tests/test_summarizer.py::TestAPIEndpoints::test_summarize_endpoint_valid PASSED
...
15 passed in 3.42s β
- Abstractive summarization (BART model)
- Extractive summarization (TF-IDF)
- 3 summary length options
- REST API with JSON responses
- Beautiful responsive web UI
- Unit + integration test coverage
- Deployed to Render
- PDF file upload and summarization
- Summarize from a URL (paste a link, get a summary)
- Export summary as .txt / .pdf
- Multi-language support
- Summary history (save and revisit past summaries)
- Browser extension
Contributions are welcome and appreciated!
- Fork the repository
- Create your feature branch
git checkout -b feature/your-feature-name- Commit your changes using Conventional Commits
git commit -m "feat: add PDF upload support"- Push to your branch
git push origin feature/your-feature-name- Open a Pull Request and describe what you changed and why
This project is licensed under the MIT License β see the LICENSE file for details.
You're free to use, copy, modify, and distribute this project, as long as the original license is included.