Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,14 @@ import streamlit as st
|
|
2 |
|
3 |
with st.form(key='my_form'):
|
4 |
sLen = st.slider('sepal lenght(cm)', 0.0, 10.0)
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
st.form_submit_button('Predict')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
with st.form(key='my_form'):
|
4 |
sLen = st.slider('sepal lenght(cm)', 0.0, 10.0)
|
5 |
+
sWid = st.slider('sepal width(cm)', 0.0, 10.0)
|
6 |
+
pLen = st.slider('petal lenght(cm)', 0.0, 10.0)
|
7 |
+
pWid = st.slider('petal width(cm)', 0.0, 10.0)
|
8 |
+
st.form_submit_button('Predict')
|
9 |
+
|
10 |
+
iris = datasets.load_iris()
|
11 |
+
x,y = iris.data, iris.target
|
12 |
+
knn = neighbors.KNeighborsClassifier(n_neighbors=4)
|
13 |
+
knn.fit(x,y)
|
14 |
+
Predict = knn.predict([[sLen,sWid,pLen,pWid]])
|
15 |
+
print(iris.target_names[knn.predict([[3,5,4,2]])])
|