A Flask web application that extracts and summarizes text content from any URL using state-of-the-art natural language processing.
- Clean, modern web interface
- Extracts main content from any URL
- Uses BART-large-CNN model for high-quality summarization
- Shows original text alongside the summary
- Provides content statistics (length and compression ratio)
- Responsive design with loading states and error handling
- Python 3.8+
- Flask 3.0.0
- Transformers 4.36.2
- BeautifulSoup4 4.12.2
- PyTorch 2.1.2
-
Clone the repository:
git clone https://github.com/apsinha/url-summarizer.git cd url-summarizer -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
Start the Flask server:
python app.py
-
Open your web browser and navigate to:
http://localhost:5000 -
Enter a URL in the input field and click "Summarize"
-
When a URL is submitted, the application:
- Fetches the webpage content
- Extracts the main text using BeautifulSoup
- Processes the text to remove unnecessary elements
- Generates a concise summary using the BART model
- Displays both the original text and summary
-
The summary generation:
- Handles long texts by splitting into chunks
- Uses beam search for better quality
- Adapts summary length based on input size
- Provides compression statistics
- The application is built with Flask for the backend
- Uses modern HTML/CSS/JavaScript for the frontend
- Implements responsive design principles
- Includes proper error handling and loading states
MIT License - feel free to use this project as you wish.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request