This project is a simple Flask-based RESTful API that summarizes text content using the Google Gemini API.
- Python 3.6+
- A Google Gemini API key
-
Clone the repository:
git clone https://github.com/hassenhamdi/ai-summarizer-api/ cd ai-summarizer-api -
Create a virtual environment:
python3 -m venv .venv
-
Activate the virtual environment:
source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile:Create a file named
.envin the project root directory and add your Gemini API key:GOOGLE_API_KEY=YOUR_GEMINI_API_KEYReplace
YOUR_GEMINI_API_KEYwith your actual Gemini API key.
-
Activate the virtual environment:
source .venv/bin/activate -
Run the Flask application:
flask run
The API will run on
http://127.0.0.1:5000/.
Summarizes the provided text content using the Gemini API.
Request Body:
{
"text": "Your text content here to be summarized."
}Response Body (Success):
{
"summary": "The summarized text."
}Response Body (Error):
{
"error": "Error message."
}curl -X POST -H "Content-Type: application/json" -d '{"text": "This is a test sentence that I want to be summarized."}' http://127.0.0.1:5000/summarizeai-summarizer-api/
├── .env
├── .gitignore
├── app.py
├── requirements.txt
└── README.md
This project demonstrates the following skills:
- Designing and building a RESTful API with Flask.
- Integrating a third-party LLM API (Gemini).
- Working with JSON data.
- Using environment variables for sensitive information.
- Managing dependencies with
requirements.txt. - Using Git for version control.
- Providing documentation with README.md.
This project was developed with the assistance of an AI agent, reflecting a "vibe coding" approach and the capabilities of agentic AI in software development, for testing purpose.