Spaces:
Sleeping
Sleeping
save
Browse files- requirements.txt +2 -1
- src/streamlit_app.py +12 -1
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
altair
|
2 |
pandas
|
3 |
streamlit
|
4 |
-
scikit-learn
|
|
|
|
1 |
altair
|
2 |
pandas
|
3 |
streamlit
|
4 |
+
scikit-learn
|
5 |
+
pickle
|
src/streamlit_app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
from sklearn.model_selection import train_test_split
|
|
|
4 |
|
5 |
from sklearn.metrics import accuracy_score
|
6 |
from sklearn.ensemble import RandomForestClassifier
|
@@ -40,4 +41,14 @@ rfc.fit(x_train.values, y_train)
|
|
40 |
|
41 |
y_pred = rfc.predict(x_test.values)
|
42 |
score = accuracy_score(y_pred, y_test)
|
43 |
-
st.write('Our accuracy score for this model is {}'.format(score))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
from sklearn.model_selection import train_test_split
|
4 |
+
import pickle
|
5 |
|
6 |
from sklearn.metrics import accuracy_score
|
7 |
from sklearn.ensemble import RandomForestClassifier
|
|
|
41 |
|
42 |
y_pred = rfc.predict(x_test.values)
|
43 |
score = accuracy_score(y_pred, y_test)
|
44 |
+
st.write('Our accuracy score for this model is {}'.format(score))
|
45 |
+
|
46 |
+
st.subheader('Model Output to Pickle')
|
47 |
+
|
48 |
+
outputfilename = 'random_forest_penguin.pickle'
|
49 |
+
rf_pickle = open( outputfilename, 'wb')
|
50 |
+
pickle.dump(rfc, rf_pickle)
|
51 |
+
rf_pickle.close()
|
52 |
+
output_pickle = open(outputfilename, 'wb')
|
53 |
+
pickle.dump(uniques, output_pickle)
|
54 |
+
output_pickle.close()
|