Predict_on_stream() ndarray is not JSON serializable
Created by: grayskripko
There is a line there where we get predictions from model res = json.dumps(res, ensure_ascii=False)
. My intent classification model returns a tuple of ndarray of probabilities and str of a picked class.
(Pdb) res
(array([5.3556631e-03, 4.8981345e-04, 1.8095224e-03, 1.2708011e-03,
3.8089836e-03, 2.2040019e-03, 1.3401045e-03, 5.2924808e-03,
1.4261100e-03, 2.2396173e-03, 7.9501802e-03, 9.6157110e-01,
5.2416250e-03], dtype=float32), 'вы робот?')
(Pdb) json.dumps(res, ensure_ascii=False)
*** TypeError: Object of type ndarray is not JSON serializable
What is the problem? It's one label classification if it matters