Spaces:
Runtime error
Runtime error
Isabel Gwara
commited on
Commit
·
58fbefd
1
Parent(s):
4b51a5a
Update app.py
Browse files
app.py
CHANGED
@@ -111,6 +111,8 @@ def general_predictor(input_list):
|
|
111 |
result = model.predict(new_input)
|
112 |
return cat_value_dicts[final_colname][result[0]]
|
113 |
|
|
|
|
|
114 |
# add data labels to replace those lost via star-args
|
115 |
inputls = []
|
116 |
for colname in data.columns:
|
@@ -122,16 +124,16 @@ for colname in data.columns:
|
|
122 |
# otherwise, just use a number input
|
123 |
if colname in cat_value_dicts:
|
124 |
radio_options = list(cat_value_dicts[colname].keys())
|
125 |
-
inputls.append(
|
126 |
else:
|
127 |
# add numerical input
|
128 |
-
inputls.append(
|
129 |
|
130 |
# generate gradio interface
|
131 |
-
if
|
132 |
prediction = general_predictor(inputls)
|
133 |
|
134 |
st.text(f"Our best recommendation for you: {prediction}")
|
135 |
|
136 |
with open('info.md') as f:
|
137 |
-
st.markdown(f.read())
|
|
|
111 |
result = model.predict(new_input)
|
112 |
return cat_value_dicts[final_colname][result[0]]
|
113 |
|
114 |
+
form = st.form('ml-inputs')
|
115 |
+
|
116 |
# add data labels to replace those lost via star-args
|
117 |
inputls = []
|
118 |
for colname in data.columns:
|
|
|
124 |
# otherwise, just use a number input
|
125 |
if colname in cat_value_dicts:
|
126 |
radio_options = list(cat_value_dicts[colname].keys())
|
127 |
+
inputls.append(form.selectbox(colname, radio_options))
|
128 |
else:
|
129 |
# add numerical input
|
130 |
+
inputls.append(form.number_imput(colname))
|
131 |
|
132 |
# generate gradio interface
|
133 |
+
if form.form_submit_button("Submit"):
|
134 |
prediction = general_predictor(inputls)
|
135 |
|
136 |
st.text(f"Our best recommendation for you: {prediction}")
|
137 |
|
138 |
with open('info.md') as f:
|
139 |
+
st.markdown(f.read())
|