This project is a web application that allows users to get concise summaries of webpages using the Google Gemini API.
- URL Input: Easily input any webpage URL.
- AI-Powered Summarization: Utilizes the Google Gemini API to generate summaries.
- Flask: A lightweight Python web framework.
- Google Generative AI (Gemini API): For generating text summaries.
- BeautifulSoup4: For parsing HTML and extracting text content from webpages.
- Requests: For making HTTP requests to fetch webpage content.
- python-dotenv: For managing environment variables.
- React: A JavaScript library for building user interfaces.
- Vite: A fast build tool for modern web projects.
- React Router DOM: For client-side routing (though not heavily used in a single-page summarizer, it's a dependency).
To get this project up and running on your local machine, follow these steps:
- Python 3.8+
- Node.js (LTS version recommended)
- npm (comes with Node.js)
git clone <repository_url>
cd webpage-summarizer-
Navigate to the
backenddirectory:cd backend -
Create a virtual environment (recommended):
Option A: Using
venv(Python's built-in virtual environment)python -m venv venv source venv/bin/activate # On Windows: .venv\Scripts\activate
Option B: Using
conda(if you have Anaconda/Miniconda installed)conda create -n webpage-summarizer-env python=3.9 # Or your preferred Python version conda activate webpage-summarizer-env -
Install the required Python packages:
pip install -r requirements.txt
-
Create a
.envfile in thebackenddirectory and add your Google Gemini API key:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"You can obtain a Gemini API key from the Google AI Studio.
-
Run the Flask backend server:
flask run
The backend server will run on
http://127.0.0.1:5000.
-
Open a new terminal and navigate to the
frontenddirectory:cd ../frontend -
Install the Node.js dependencies:
npm install
-
Start the Vite development server:
npm run dev
The frontend application will typically open in your browser at
http://localhost:5173.
- Ensure both the backend (Flask) and frontend (React/Vite) servers are running.
- Open your web browser and navigate to the frontend URL (e.g.,
http://localhost:5173). - Enter the URL of the webpage you wish to summarize into the input field.
- Click the "Summarize" button.
- The summary generated by the Gemini API will be displayed on the page.
webpage-summarizer/
├── backend/ # Flask backend application
│ ├── .env # Environment variables (e.g., GEMINI_API_KEY)
│ ├── app.py # Main Flask application and API endpoint
│ ├── requirements.txt # Python dependencies
│ └── ...
├── frontend/ # React frontend application
│ ├── public/ # Static assets
│ ├── src/ # React source code
│ │ ├── App.jsx # Main React component
│ │ └── ...
│ ├── package.json # Node.js dependencies and scripts
│ ├── vite.config.js # Vite configuration
│ └── ...
└── README.md # Project README file