mediapipe_fastapi_20classes / model_predict.py
tosanoob's picture
First upload
aa25f09 verified
raw
history blame contribute delete
411 Bytes
from model import load_model
import json
import numpy as np
classifier = load_model()
with open("label_list.json","r") as infile:
actions = list(json.load(infile).values())
def model_predict(input):
"""Perform prediction on input (numpy array), return a label (str)"""
res = classifier.predict(np.expand_dims(input,axis=0))[0]
label = actions[np.argmax(res)]
return label