A web application that summarizes dialogue and text content using a fine-tuned T5 transformer model, served through a FastAPI backend.
This project provides a simple interface for pasting text or dialogue and receiving a concise summary in return. The summarization is powered by a T5 (Text-to-Text Transfer Transformer) model, and the application is built with a FastAPI backend and a lightweight HTML/CSS/JavaScript frontend.
- Text summarization using a fine-tuned T5 model
- Simple, responsive web interface
- REST API endpoint for programmatic access
- Input cleaning and preprocessing before summarization
- Beam search decoding for improved summary quality
Backend
- Python
- FastAPI
- Uvicorn (ASGI server)
- Hugging Face Transformers
- PyTorch
Frontend
- HTML
- CSS
- Vanilla JavaScript
Text-Summarizer-App/
├── app.py # FastAPI application and model logic
├── index.html # Frontend page
├── static/
│ ├── script.js # Frontend logic (form handling, API calls)
│ └── style.css # Styling
├── text-summarizer_saved_summary_model/
│ ├── config.json
│ ├── generation_config.json
│ ├── model.safetensors
│ ├── tokenizer_config.json
│ └── tokenizer.json
├── requirements.txt # Python dependencies
└── README.md
- Python 3.11 or later
- pip
-
Clone the repository
git clone https://github.com/Samir-BK/Text-Summarizer-App.git cd Text-Summarizer-App -
Install dependencies
pip install -r requirements.txt
-
Run the application
python -m uvicorn app:app --reload
-
Open your browser and navigate to
http://127.0.0.1:8000
Summarizes the provided text.
Request body
{
"dialogue": "Your text or dialogue to summarize goes here."
}Response
{
"summary": "Generated summary text."
}- Input text is cleaned (whitespace normalization, HTML tag removal, lowercasing).
- The cleaned text is tokenized and passed to the T5 model.
- The model generates a summary using beam search decoding.
- The generated token sequence is decoded back into readable text and returned to the frontend.
- The model files are loaded locally from the
text-summarizer_saved_summary_model/directory. torchwill automatically use GPU (CUDA or MPS) if available, otherwise it falls back to CPU.
This project is provided as-is for educational and demonstration purposes.