I run the same code on a jupyter notebook, it works fine.
but when I run it on a script with streamlit i keep getting “Object of type bytes is not JSON serializable”. this is the script codes
def lime_explain(x_train, x_val, y_train, feat, model, i): ml_model = pickle.load(open(model, 'rb')) explainer = lime.lime_tabular.LimeTabularExplainer(x_train.values, feature_names = feat, class_names = ['True', 'False'], mode='classification', training_labels=x_train.colu mns.values.tolist()) predict_fn = lambda x: ml_model.predict_proba(x).astype(float) exp = explainer.explain_instance(x_val.values[i], predict_fn, num_features = 5) exp.save_to_file("new_lime2.html").
and this is the jupyter code with the output by the left.
Please what could be the problem? thanks in advance