Siloka-ml-gateway is a consumable REST API service for the siloka-backend and collaboratively developed by Bangkit Academy 2022 Cohort.
Contributor to this repostory:
This project was built on top of:
- Install Poetry
- Install dependencies
poetry install
- Create
.env
file and fill it withGOOGLE_APPLICATION_CREDENTIALS='local/path/to/service_account_key.json'
$ poetry run uvicorn app.main:app --reload
Or
$ poetry shell
$ uvicorn app.main:app --reload
$ docker build -t siloka-ml-gateway .
$ docker run -d -p 80:80 siloka-ml-gateway
-
Open main.py and checks
GOOGLE_APP_CREDENTIALS = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS") ML_STORAGE_BUCKET = "siloka-ml-resources"
-
Change
ML_STORAGE_BUCKET
value to match your bucket name where you stored your model. -
Store your model, tokenizer, and intents in Google Cloud Storage Bucket.
-
Make sure your model, tokenizer, and intents are named with
chatbot-model.h5
,tokenizer.pickle
, andintents.json
. or modify this snippet in main.py according to your needsdownload_blob_from_bucket( ML_STORAGE_BUCKET, "chatbot-model.h5", "model/chatbot-model.h5" ) download_blob_from_bucket( ML_STORAGE_BUCKET, "tokenizer.pickle", "model/tokenizer.pickle" ) download_blob_from_bucket(ML_STORAGE_BUCKET, "intents.json", "model/intents.json") model = load_model("./model/chatbot-model.h5") tokenizer = load_tokenizer("./model/tokenizer.pickle") intents = load_file("./model/intents.json")