Spaces:
Sleeping
Sleeping
# Setup execution | |
ml_components = load_ml_components(fp=ml_core_fp) | |
idx_to_labels = {i: l for (i, l) in enumerate(ml_components["labels"])} | |
end_2_end_pipeline = ml_components["pipeline"] | |
# Prediction | |
pred_output = end_2_end_pipeline.predict_proba(df_input) | |
class_idx = pred_output.argmax(axis=1) | |
scores = pred_output[:, class_idx] | |
df_input['predicted_class'] = class_idx | |
df_input['predicted_class'] = df_input['predicted_class'].replace( | |
idx_to_labels) | |
df_input['confidence_score'] = scores |