mewmnp commited on
Commit
ce6935d
·
1 Parent(s): 2bcd631

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,8 +1,17 @@
1
  import streamlit as st
 
2
 
3
  with st.form(key='my_form'):
4
  sLen = st.slider('sepal length(cm) ', 0.0, 10.0)
5
  sWid = st.slider('sepal width(cm) ', 0.0, 10.0)
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)
6
  sWid = st.slider('sepal width(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
+
12
+ iris = datasets.load_iris()
13
+ x,y = iris.data, iris.target
14
+ knn = neighbors.KNeighborsClassifier(n_neighbors=6)
15
+ knn.fit(x,y)
16
+ predict = knn.predict([[sLen,sWid,pLen,pWid]])
17
+ st.write(iris.target_names[predict([[3,5,4,2]])])