Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sayak119/fashion-mnist-flask
PoC to serve machine learning models using flask
https://github.com/sayak119/fashion-mnist-flask
api fashion-mnist flask jupyter-notebook keras postman tensorflow
Last synced: 7 days ago
JSON representation
PoC to serve machine learning models using flask
- Host: GitHub
- URL: https://github.com/sayak119/fashion-mnist-flask
- Owner: sayak119
- Created: 2019-07-31T16:50:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-31T12:46:32.000Z (over 5 years ago)
- Last Synced: 2024-11-17T22:25:17.044Z (2 months ago)
- Topics: api, fashion-mnist, flask, jupyter-notebook, keras, postman, tensorflow
- Language: Jupyter Notebook
- Size: 58.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Please star this repo if you are using it as a reference. Thanks.**
# Classification ModelsThis is a PoC for creating a pipeline that does the following -
* Training a model. Here it is done on **Fashion MNIST** and **MNIST** datasets.
* Load the saved weights.
* Expose an **API** using Flask.## System Configuration Used
* **OS -** Ubuntu 18.04 LTS
* **Python Version -** 3.6
* **Conda Version -** Miniconda3-latest-Linux-x86_64
* **Shell Flavour -** ZSH (Optional)
* **Tensorflow Version -** 1.13.1
* **Keras Version -** keras-2.2.4## How to run?
* Install Miniconda from **[here](https://docs.conda.io/en/latest/miniconda.html)**.
* Run the following command
```
conda update conda
```
* Clone the repository
* Install dependencies from `environment.yml` file
```
conda env create -f environment.yml
```* Activate your environment
```
conda activate classification_model
```Refer the doc **[here](https://www.anaconda.com/conda-4-6-release/)** for knowing what all flavours are supported.
* Visit `src/train` folder and run the following command
```
python3 fashion_mnist.py
```
You will get a **h5** model and a **json** file as an output in the `model` folder. **You can do the same thing for MNIST dataset.**
* Now go to `src/server` and start the server using the following command
```
python3 server.py
```
**For MNIST dataset go to** `pre-process` **folder and change json_file and load_weights accordingly**
* Open a new temrinal and visit `src/test` for images and test according to the dataset you loaded by using the following command
```
curl -X POST -F '[email protected]' http://localhost:5000/predict
```
For other images, in place of `trouser.jpg` add the name of that new input image.## Output format
Numbers are returned in both the cases. In case of **MNIST** dataset, it directly corresponds to the predicted number whereas in case of **Fashion MNIST** dataset, it corresponds to the class number. For more information refer this **[link](https://github.com/zalandoresearch/fashion-mnist#labels)**.
**NOTE :** Since `python2` is being deprecated and is going to go out of service on January 1st, 2020, hence the code was made for `python3`. Depending on the default version of `python` in your system you may or may not have to run the command as `python3 fashion_mnist.py`. It can be `python fashion_mnist.py` given that default version is `python3`.