sugarcane / app.py
auey's picture
Update app.py
d1d84e4
raw
history blame contribute delete
543 Bytes
import streamlit as st
from sklearn import neighbors, datasets
with st.form(key='my_form'):
sLen = st.slider('sepal length (cm) ', 0.0, 10.0)
sWid = st.slider('sepal Width (cm) ', 0.0, 10.0)
pLen = st.slider('petal length (cm) ', 0.0, 10.0)
pWid = st.slider('petal Width (cm) ', 0.0, 10.0)
st.form_submit_button('predict')
iris = datasets.load_iris()
X,y = iris.data, iris.target
knn = neighbors.KNeighborsClassifier(n_neighbors=2)
knn.fit(X,y)
predict = knn.predict([[sLen,sWid,pLen,pWid]])
st.write(iris.target_names[predict])