Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import seaborn as sns | |
| df=sns.load_dataset('iris') | |
| x=df.drop(columns="species") | |
| y=df["species"] | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.neighbors import KNeighborsClassifier | |
| x_train, x_test, y_train, y_test= train_test_split(x,y, train_size=0.8 , random_state=42) | |
| model=KNeighborsClassifier(n_neighbors=3) | |
| model.fit(x_train, y_train) | |
| accuracy = model.score(x_test, y_test) | |
| def greet(sepal_length,sepal_weidth,petal_length,petal_weidth): | |
| return model.predict([[sepal_length,sepal_weidth,petal_length,petal_weidth]]) | |
| iface = gr.Interface(fn=greet, description="you have to give the 4 values sepal_length, sepal_weidth, petal_length and petal_weidth amd the project will predict the specie", | |
| title="iris flower species classifier", | |
| inputs=["number","number","number","number"], outputs="textbox") | |
| iface.launch() |