auey commited on
Commit
d1d84e4
1 Parent(s): 5fe3620

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import streamlit as st
 
2
 
3
  with st.form(key='my_form'):
4
  sLen = st.slider('sepal length (cm) ', 0.0, 10.0)
@@ -6,3 +7,10 @@ with st.form(key='my_form'):
6
  pLen = st.slider('petal length (cm) ', 0.0, 10.0)
7
  pWid = st.slider('petal Width (cm) ', 0.0, 10.0)
8
  st.form_submit_button('predict')
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from sklearn import neighbors, datasets
3
 
4
  with st.form(key='my_form'):
5
  sLen = st.slider('sepal length (cm) ', 0.0, 10.0)
 
7
  pLen = st.slider('petal length (cm) ', 0.0, 10.0)
8
  pWid = st.slider('petal Width (cm) ', 0.0, 10.0)
9
  st.form_submit_button('predict')
10
+
11
+ iris = datasets.load_iris()
12
+ X,y = iris.data, iris.target
13
+ knn = neighbors.KNeighborsClassifier(n_neighbors=2)
14
+ knn.fit(X,y)
15
+ predict = knn.predict([[sLen,sWid,pLen,pWid]])
16
+ st.write(iris.target_names[predict])