A lightweight and efficient FastAPI-based microservice for summarizing long-form text using AI models. Built with simplicity, extensibility, and modern Python tooling in mind, ideal as a microservice.
- REST API with FastAPI
- Supports customizable summarization with optional parameters
- Logs all requests and responses to
request_logs.json - Uses Pydantic for validation and structured responses
- Easily containerizable and cloud-deployable
Make sure to have Python 3.8+ installed.
.env file that follows this structure:
openai-compatible-model-url=*url*/v1
model-api-key=*key*Please note that the model-api-key should be set to None if the key is not required, or you will get an error.
Install dependencies in a virtual environment:
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtTo start the FastAPI server locally:
uvicorn main:app --reloadVisit the docs at http://127.0.0.1:8000/docs for interactive API testing.
You can also build the docker-image:
docker build -t summarizer .And run it:
docker run -d -p 8000:8000 summarizerYour app will be available at: http://localhost:8000