kmlf commited on
Commit
3d2fc57
·
1 Parent(s): 5b864ec

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +49 -0
  2. model.joblib +3 -0
  3. requirements.txt +5 -0
  4. unique_values.joblib +3 -0
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """app.ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1QDGbOvpwcdGFAUHlqUqKjWG_UkARrh_A
8
+ """
9
+
10
+ import joblib
11
+ import pandas as pd
12
+ import streamlit as st
13
+
14
+ SPC_DICT = {'setosa': 0,
15
+ 'versicolor': 1,
16
+ 'virginica': 2
17
+ }
18
+
19
+
20
+ model = joblib.load('model.joblib')
21
+ unique_values = joblib.load('unique_values.joblib')
22
+ #unique_srecies = unique_values["srecies"]
23
+ unique_sepal_length = unique_values["sepal_length"]
24
+ unique_sepal_width = unique_values["sepal_width"]
25
+ unique_petal_length = unique_values["petal_length"]
26
+ unique_petal_width = unique_values["petal_width"]
27
+
28
+ def main():
29
+ st.title("Iris")
30
+
31
+ with st.form("questionnaire"):
32
+ sepal_length = st.slider("sepal_length", min_value=0, max_value=20)
33
+ sepal_width = st.slider("sepal_width", min_value=0, max_value=20)
34
+ petal_length = st.slider("petal_length", min_value=0, max_value=20)
35
+ petal_width = st.slider("petal_width", min_value=0, max_value=20)
36
+ clicked = st.form_submit_button("Predict iris")
37
+
38
+ if clicked:
39
+ result = model.predict(pd.DataFrame({
40
+ "sepal_length": [sepal_length],
41
+ "sepal_width": [sepal_width],
42
+ "petal_length": [petal_length],
43
+ "petal_width": [petal_width]
44
+ }))
45
+ result = 'setosa' if result[0] == 0 result = 'versicolor' elif result[0] == 1 else result = 'virginica'
46
+ st.success('The predicted iris is {}'.format(result))
47
+
48
+ if __name__ == '__main__':
49
+ main()
model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b19675355e2ada413846c7f9fafe6b638f2fb6de34aa39d896da119bf76d8ea
3
+ size 246917
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5
unique_values.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fc4c0c9343f90ad7f5857c44ddadef3cb4a52c217e6f01da4914bb439b72030
3
+ size 63