The simple FastAPI wrapper for ML model.
pip install python-multipart
pip install fastapi
pip install uvicorn
pip install passlib
pip install python-jose
- Edit
config.yaml
. At least, you wanna changejwt_secret_key
value with
openssl rand -hex 512
- Edit user list in
config_users.yaml
. The hash forpassword
key may be generated with
python make_hash.py <password>
-
Replace script
server/model/spec.py
with your own, that is implemented methodsmodel_load(path, device='cpu')
andmodel_predict(text, with_intents=True, probs=True, threshold=.5, only_true=False)
. Scriptsserver/model/model*.py
may be removed or replaced with your own model definition. -
Put the model in the directory
model0
(or change themodel_name
inconfig.yaml
). -
Edit
run.sh
orrun.bat
and start the server.
modelsrv0 is released under the Creative Commons License. See the LICENSE file for more details.