Spaces:
Runtime error
Runtime error
Isabel Gwara
commited on
Commit
·
8f299bb
1
Parent(s):
bf8a587
Update app.py
Browse files
app.py
CHANGED
@@ -102,15 +102,15 @@ y_pred = model.predict(x_test)
|
|
102 |
|
103 |
|
104 |
# predictor for generic number of features
|
105 |
-
def general_predictor(
|
106 |
features = []
|
107 |
|
108 |
# transform categorical input
|
109 |
-
for colname,
|
110 |
if (colname in cat_value_dicts):
|
111 |
-
features.append(cat_value_dicts[colname][
|
112 |
else:
|
113 |
-
features.append(
|
114 |
|
115 |
# predict single datapoint
|
116 |
new_input = [features]
|
@@ -135,7 +135,6 @@ for colname in data.columns:
|
|
135 |
|
136 |
# generate gradio interface
|
137 |
if st.button("Submit"):
|
138 |
-
|
139 |
-
prediction = model.predict(x)[0]
|
140 |
|
141 |
st.text(f"This instance is a {prediction}")
|
|
|
102 |
|
103 |
|
104 |
# predictor for generic number of features
|
105 |
+
def general_predictor(input_list):
|
106 |
features = []
|
107 |
|
108 |
# transform categorical input
|
109 |
+
for colname, input in zip(data.columns, input_list):
|
110 |
if (colname in cat_value_dicts):
|
111 |
+
features.append(cat_value_dicts[colname][input])
|
112 |
else:
|
113 |
+
features.append(input)
|
114 |
|
115 |
# predict single datapoint
|
116 |
new_input = [features]
|
|
|
135 |
|
136 |
# generate gradio interface
|
137 |
if st.button("Submit"):
|
138 |
+
prediction = general_predictor(inputls)
|
|
|
139 |
|
140 |
st.text(f"This instance is a {prediction}")
|