Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# creating a predict function to be passed into gradio UI
def predict(model, sepal_length, sepal_width, petal_length, petal_width):
df = pd.DataFrame.from_dict({'sepal_length': [sepal_length], 'sepal_width': [sepal_width],
'petal_length': [petal_length], 'petal_width': [petal_width]})
model_index = list(compare_model_results['Model']).index(model)
model = best[model_index]
pred = predict_model(model, df, raw_score=True)
return {'Iris-setosa': pred['Score_Iris-setosa'][0].astype('float64'),
'Iris-versicolor': pred['Score_Iris-versicolor'][0].astype('float64'),
'Iris-virginica' : pred['Score_Iris-virginica'][0].astype('float64')}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment