- This project is about generating text from image. To get started, follow the instructions below.
- This is the project structure:
|-jenkins - Directory for Jenkins configuration files
|-k8s - Directory for Helm chart to deploy the application
|-models - Directory for Deep Learning models
|--vocabs.json - File for vocabulary NLP model
|-notebooks - Directory for crawling and training data
|--data - Directory for data (crawling)
|--data_crawler.ipynb
|--requirements.txt - File contains packages for training and crawling
|--training.ipynb
|-src - Directory for main application
|-Dockerfile - File to create and deploy main application
|-Makefile - File contains some commands (make + <cmd>)
|-requirements.txt - File contains packages for main application
- Git
- Anaconda (optional)
- Python: 3.9
- Kubernates
- Minikube (for weak machine) - using this in this project or Minikf
- Docker
- Makefile (optional)
Using anaconda:
conda create -n <env_name> python=3.9
conda activate <env_name>
pip install -r requirements.txt
uvicorn src.main:app --reload
Or
make start-app-dev
docker build --tag "jigglediggle1/image-captioning" .
docker run -d --name="image-captioning" -p 30000:30000 "jigglediggle1/image-captioning"
Or
make start-app-dev
Notes: The docker's memory default only has 3GB
memory, may not enough for this project, should increase it (in Desktop) to at least 6G
Notes: The minikube's memory default only has 2GB
memory, may not enough for this project, should increase it by the following command in MB (and it should be lower than Docker's memory)
minikube config set memory 4000
And delete the minikube
(if you already initialized one before).
WARNING: This will delete all of your pods
minikube delete
Then start the minikube
minikube start
Minikube has dashboard to monitor the pods and more. To open it, run:
minikube dashboard
helm upgrade --install nginx-ingress ./k8s/nginx-ingress/. --namespace=image-captioning
helm upgrade --install ic-app ./k8s/ic-app/. --namespace=image-captioning
Then, we will need to run minikube tunnel
minikube tunnel
And finally, open new terminal, run port-forward to use the application
kubectl --namespace image-captioning port-forward svc/ic-app 5000:30000
Or
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ic-app.fullname" . }})
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 5000:30000
And open this url to visit the application: localhost:5000/docs