File size: 539 Bytes
d2e743c
ce6935d
2bcd631
 
 
 
 
 
5e4aca1
ce6935d
 
 
 
 
 
 
5e4aca1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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=6)
knn.fit(x,y)
predict = knn.predict([[sLen,sWid,pLen,pWid]])
st.text(iris.target_names[predict])