fostroll / modelsrv0

The FastAPI wrapper for ML model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modelsrv0

The simple FastAPI wrapper for ML model.

Requirements

pip install python-multipart
pip install fastapi
pip install uvicorn
pip install passlib
pip install python-jose

Usage

  1. Edit config.yaml. At least, you wanna change jwt_secret_key value with
openssl rand -hex 512
  1. Edit user list in config_users.yaml. The hash for password key may be generated with
python make_hash.py <password>
  1. Replace script server/model/spec.py with your own, that is implemented methods model_load(path, device='cpu') and model_predict(text, with_intents=True, probs=True, threshold=.5, only_true=False). Scripts server/model/model*.py may be removed or replaced with your own model definition.

  2. Put the model in the directory model0 (or change the model_name in config.yaml).

  3. Edit run.sh or run.bat and start the server.

License

modelsrv0 is released under the Creative Commons License. See the LICENSE file for more details.

About

The FastAPI wrapper for ML model

License:Creative Commons Zero v1.0 Universal


Languages

Language:Python 99.2%Language:Shell 0.4%Language:Batchfile 0.4%