I am deploying my flask app to azure and it works, but the docker image is way too big (think 10GB), this is slowing the program to the point of being unusable. This is ridiculous as the program uses 2 .py files and 3 .html templates, totalling a few kbs.
What is causing the issue is my requirements doc:
Flask==3.0.3 Flask-WTF==1.2.1 WTForms==3.1.2 python-docx==1.1.2 Werkzeug==3.0.3 torch==2.3.1 numpy==1.24.0 git+https://github.com/m-bain/whisperX.git@main#egg=whisperx
The whisperx function is very demanding and is why RUN /bin/sh -c pip install -r requirements.txt # buildkit is using 9.62 GB.
Is there a way to only install what I need? Im importing the entire torch library for one function (cuda.isavailable) and the entire whisperx library for only a few functions.
How can I save space so my program will run well?
Expected a reduction in file size.
Tried changing my imports to from whisperx import functionName, nextFunction
didnt work because whisperx dot functionName is how functions are called and whisperx not defined.
Tried from torch import cuda but this was a waste of time because whisperx imports it all anyway.