Spaces:
Runtime error
Runtime error
Isabel Gwara
commited on
Commit
·
f100c9a
1
Parent(s):
848851d
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ st.subheader('Feeling like you might need a better coping strategy? Take the qui
|
|
28 |
### data transformation ###
|
29 |
### ------------------------------ ###
|
30 |
|
31 |
-
def
|
32 |
# load dataset
|
33 |
uncleaned_data = pd.read_csv('data.csv')
|
34 |
|
@@ -73,13 +73,13 @@ def load_dataset():
|
|
73 |
|
74 |
cat_value_dicts[colname] = new_dict
|
75 |
data[colname] = transformed_col_vals
|
76 |
-
|
77 |
-
|
78 |
-
### -------------------------------- ###
|
79 |
-
### model training ###
|
80 |
-
### -------------------------------- ###
|
81 |
-
|
82 |
-
|
83 |
# select features and predicton; automatically selects last column as prediction
|
84 |
cols = len(data.columns)
|
85 |
num_features = cols - 1
|
@@ -105,7 +105,6 @@ try:
|
|
105 |
with open('model.pkl', 'r') as f:
|
106 |
model = pkl.load(f)
|
107 |
except FileNotFoundError as e:
|
108 |
-
load_dataset()
|
109 |
train_model()
|
110 |
|
111 |
|
|
|
28 |
### data transformation ###
|
29 |
### ------------------------------ ###
|
30 |
|
31 |
+
def train_model():
|
32 |
# load dataset
|
33 |
uncleaned_data = pd.read_csv('data.csv')
|
34 |
|
|
|
73 |
|
74 |
cat_value_dicts[colname] = new_dict
|
75 |
data[colname] = transformed_col_vals
|
76 |
+
|
77 |
+
|
78 |
+
### -------------------------------- ###
|
79 |
+
### model training ###
|
80 |
+
### -------------------------------- ###
|
81 |
+
|
82 |
+
|
83 |
# select features and predicton; automatically selects last column as prediction
|
84 |
cols = len(data.columns)
|
85 |
num_features = cols - 1
|
|
|
105 |
with open('model.pkl', 'r') as f:
|
106 |
model = pkl.load(f)
|
107 |
except FileNotFoundError as e:
|
|
|
108 |
train_model()
|
109 |
|
110 |
|