This solution trains an linear classifier to predict receipt scan.
Python >= 3.8, Pip, Docker
NOTE: Please run pip install requirements.txt to install dependencies for both training and inferencing.
Inference
- Open a command line tool, navigate to the project directory. run
python3 app.py. - Visit localhost:8020, enter a date in MM/DD/YYYY format and click submit.
- Run
Ctrl+Cin the same command line window to abort/exit.
Training
- Prepare your data file, or use the one provided by the project directory.
- In a command line tool, enter
jupyter notebook, it will automatically open a window. - In the window, navigate to project folder, double click the file
Train.ipynb, this will open the file in a new window. - (Optional) In the new window, if you want to experinment with your own file, replace url with your data file's path.
- Select Run - Run All Cells, this command will train and export model weights along with some performance insights.
NOTE: Docker version is not usable due to a weird gradio error (not invoking function calls with button click).
- Open a command line tool, navigate to
./appdirectory of the project directory. - Run
docker build -t gefei_fetch_ml ./to build image. - Run
docker run -p 8123:8020 gefei_fetch_mlto run the image, visit the site with localhost:8123, you can replace 8123 with any ports you wish to use. - Run
docker stop gefei_fetch_mlto stop container. - Run
docker rm gefei_fetch_mlto remove the container.