This Flask-based application generates captions for images using machine learning. It leverages Hypercorn and asyncio for improved performance.
Prerequisites:
- Python 3.9
- Pip
- Virtualenv (optional)
Steps:
- Clone the repository.
- (Optional) Create and activate a virtual environment:
python -m venv venv #python3 for linux source venv/bin/activate # linux venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
Prerequisites:
- Docker
- Docker Compose
Steps:
- Run
docker-compose up
to start the application.
The application uses Hypercorn as an ASGI server, along with asyncio, to enhance performance through asynchronous processing. This setup allows for handling multiple requests efficiently.
For scaling the application:
- Create Kubernetes configurations for deployment, services, and horizontal pod autoscalers.
- Deploy to a Kubernetes cluster, adjusting replicas as needed for load.
Send a POST request to /caption
with an image file.
curl -X POST -F "file=@path/to/your/image.jpg" http://localhost:5000/caption
Execute tests using python -m unittest
from the src directory.
Contributions are welcome following the standard fork, branch, and pull request workflow.