After you trained a machine learning model, you might want someone to test or deploy it on your product.
This repository contains the sample code to make your machine learning API from the scratch.
Here, FastAPI and Gender Detection Model are used.
- Create your original env by using
pyenv
orvenv
- pyenv
>> /Users/USERNAME/.pyenv/versions/3.6.5/bin/python -m venv venv/3.6.5 >> source venv/3.6.5/bin/activate >> (3.6.5) pip install --upgrade pip
- venv
>> python -m venv venv/3.6.5 >> source venv/3.6.5/bin/activate >> (3.6.5) pip install --upgrade pip
- Install packages
>> pip install -r requirements.txt
- Run!
>> cd src
>> python app.py
- POST an image to the endpoint
http://0.0.0.0:7000/genpredict/
- Build a image
>> pwd
~/ml-api/src
>> cd ..
>> sh build.sh
Once it's done, mlapi
image was created.
- Create the container
docker-compose up
- local app
- Make Dockerfile work
- Allow
docker-compose up
that can access from local - Streamlit UI