pysr1 / fastapi-ml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploying and Hosting a Machine Learning Model with FastAPI and Heroku

Want to learn how to build this?

Check out the post.

Want to use this project?

  1. Fork/Clone

  2. Create and activate a virtual environment:

    $ python3 -m venv venv && source venv/bin/activate
  3. Install the requirements:

    (venv)$ pip install -r requirements.txt
  4. Train the model:

    (venv)$ python
    
    >>> from model import train, predict, convert
    >>> train()
  5. Run the app:

    (venv)$ uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8008
  6. Test:

    $ curl \
      --header "Content-Type: application/json" \
      --request POST \
      --data '{"ticker":"MSFT"}' \
      http://localhost:8008/predict

About


Languages

Language:Python 100.0%