Simple FastAPI application that detects whether a banknote is authentic or not.
The dataset was taken from this kaggle dataset
From the kaggle dataset page: Data were extracted from images that were taken from genuine and forged banknote-like specimens. For digitization, an industrial camera usually used for print inspection was used. The final images have 400x 400 pixels. Due to the object lens and distance to the investigated object gray-scale pictures with a resolution of about 660 dpi were gained.
Wavelet Transform tool were used to extract features from images. Dataset can be used for Binary Classification sample problems
The dataset is a .CSV file containing five columns:
- variance - (float) variance of Wavelet Transformed image
- skewness - (float) skewness of Wavelet Transformed image
- curtosis - (float) curtosis of Wavelet Transformed image
- entropy - (float) entropy of Wavelet Transformed image
- class - (integer) label 0 or 1
Simple random forest model is fit on the dataset. Jupyter notebook provided in repository. The model is then saved as a pickle file and loaded in the FastAPI and Streamlit apps.
There are three important files in the repository related to deployment:
app.py
: FastAPI codemain.py
: Streamlit codeDockerfile
: builds python3.8-slim image with necessary dependencies to run FastAPI app. Automatically starts FastAPI server everytime you run the container.
To build Docker image:
cd <folder_containing_Dockerfile>
docker build -t <image_name> .
FastAPI server runs by default on port 8000. Change port number insidemain.py
. To start FastAPI server:
python main.py
To run Streamlit app (runs on port 8501 by default):
streamlit run app.py --server.port <port_number>
Followed this YouTube playlist.