AI Text Summarizer is a web application that generates concise summaries from large text passages and PDF documents using Natural Language Processing (NLP).
The application allows users to:
- Paste text and generate summaries
- Upload PDF documents and summarize their contents
- Choose between Short, Medium, and Long summaries
- View generated summaries instantly through a simple user interface
The project follows a client-server architecture using React for the frontend and FastAPI for the backend.
Users can enter large blocks of text and generate concise summaries.
Users can upload PDF files. The application extracts text from the PDF and generates a summary.
Users can select:
- Short Summary
- Medium Summary
- Long Summary
A loading message is displayed while the summary is being generated.
The frontend communicates with the backend using FastAPI APIs.
- React.js
- Axios
- JavaScript
- HTML
React was chosen because:
- Component-based architecture
- Fast rendering
- Easy API integration
- Suitable for modern web applications
Axios is used for:
- Sending HTTP requests
- Communicating with FastAPI endpoints
- Handling API responses efficiently
- FastAPI
- Python
FastAPI was chosen because:
- High performance
- Easy REST API development
- Automatic API documentation
- Simple integration with machine learning models
Model Used:
sshleifer/distilbart-cnn-12-6
- Designed specifically for summarization tasks
- Generates abstractive summaries
- Produces human-like summaries instead of simply extracting sentences
- Lightweight compared to larger transformer models
Library Used:
pypdf- Extracts text from uploaded PDF files
- Lightweight and easy to integrate
- Supports multi-page PDFs
AI-Summarizer
│
├── backend
│ ├── main.py
│ ├── summarizer.py
│ ├── pdf_reader.py
│ ├── requirements.txt
│
├── frontend
│ ├── src
│ │ ├── App.jsx
│ │ ├── main.jsx
│ │
│ ├── package.json
│
└── README.md
Main FastAPI application.
Responsibilities:
- Creates API endpoints
- Receives user requests
- Calls summarization functions
- Returns generated summaries
Endpoints:
POST /summarize
POST /summarize-pdf
Contains the summarization logic.
Responsibilities:
- Loads the Hugging Face model
- Receives text input
- Generates summaries
- Supports different summary lengths
Responsible for PDF text extraction.
Responsibilities:
- Reads uploaded PDF files
- Extracts text page-by-page
- Returns extracted text to backend
Main React component.
Responsibilities:
- User interface
- Text input
- PDF upload
- Summary length selection
- API communication
- Displaying generated summaries
- User enters text.
- User selects summary length.
- User clicks "Summarize".
- React sends request to FastAPI.
- FastAPI calls summarizer.py.
- Hugging Face model generates summary.
- Summary is returned to frontend.
- Summary is displayed to the user.
- User uploads PDF.
- PDF is sent to FastAPI.
- pdf_reader.py extracts text.
- Extracted text is passed to summarizer.py.
- Summary is generated.
- Summary is returned to frontend.
- Summary is displayed.
POST /summarizeRequest:
{
"text": "Input text",
"length": "medium"
}Response:
{
"summary": "Generated summary"
}POST /summarize-pdfForm Data:
file
length
Response:
{
"summary": "Generated summary"
}Navigate to backend folder:
cd backendCreate virtual environment:
python -m venv venvActivate virtual environment:
venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtRun FastAPI server:
python -m uvicorn main:app --reloadBackend URL:
http://127.0.0.1:8000
Navigate to frontend folder:
cd frontendInstall dependencies:
npm installRun React application:
npm run devFrontend URL:
http://localhost:5173
Frontend is deployed using Vercel. https://ai-text-summarizer-dun.vercel.app
The deployed frontend provides the user interface for the application.
The application requires the FastAPI backend to be running because:
- Summarization is performed on the server side.
- PDF text extraction occurs on the backend.
- The frontend communicates with backend APIs to generate summaries.
- https://ai-text-summarizer-cuke.onrender.com/docs
- https://ai-text-summarizer-cuke.onrender.com
- Authentication and user accounts
- Summary history storage
- Download summaries as PDF
- Multiple language support
- AI-powered keyword extraction
- AI-powered topic detection
- Cloud deployment of backend services
- Enhanced PDF processing
Avisha Srivastava
AI Text Summarizer Internship Project
Built using React, FastAPI, Hugging Face Transformers, and PyPDF.