Created
April 20, 2021 20:42
-
-
Save moezali1/2a383489a08757df93572676d20635e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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