Spaces:
Runtime error
Runtime error
Isabel Gwara
commited on
Commit
·
9ce0485
1
Parent(s):
e4312be
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,11 +9,18 @@ from sklearn.model_selection import train_test_split
|
|
| 9 |
from sklearn.linear_model import LogisticRegression
|
| 10 |
from sklearn import metrics
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
with open('styles.css') as f:
|
| 13 |
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
|
| 14 |
|
| 15 |
with open('info.md') as f:
|
| 16 |
-
|
| 17 |
|
| 18 |
|
| 19 |
### ------------------------------ ###
|
|
@@ -134,13 +141,13 @@ for colname in data.columns:
|
|
| 134 |
# otherwise, just use a number input
|
| 135 |
if colname in cat_value_dicts:
|
| 136 |
radio_options = list(cat_value_dicts[colname].keys())
|
| 137 |
-
inputls.append(
|
| 138 |
else:
|
| 139 |
# add numerical input
|
| 140 |
-
inputls.append(
|
| 141 |
|
| 142 |
# generate gradio interface
|
| 143 |
-
if
|
| 144 |
prediction = general_predictor(inputls)
|
| 145 |
|
| 146 |
-
|
|
|
|
| 9 |
from sklearn.linear_model import LogisticRegression
|
| 10 |
from sklearn import metrics
|
| 11 |
|
| 12 |
+
|
| 13 |
+
### ----------------------------- ###
|
| 14 |
+
### interface setup ###
|
| 15 |
+
### ----------------------------- ###
|
| 16 |
+
|
| 17 |
+
col1, col2 = st.columns(2)
|
| 18 |
+
|
| 19 |
with open('styles.css') as f:
|
| 20 |
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
|
| 21 |
|
| 22 |
with open('info.md') as f:
|
| 23 |
+
col1.markdown(f.read())
|
| 24 |
|
| 25 |
|
| 26 |
### ------------------------------ ###
|
|
|
|
| 141 |
# otherwise, just use a number input
|
| 142 |
if colname in cat_value_dicts:
|
| 143 |
radio_options = list(cat_value_dicts[colname].keys())
|
| 144 |
+
inputls.append(col2.selectbox(colname, radio_options))
|
| 145 |
else:
|
| 146 |
# add numerical input
|
| 147 |
+
inputls.append(col2.number_imput(colname))
|
| 148 |
|
| 149 |
# generate gradio interface
|
| 150 |
+
if col2.button("Submit"):
|
| 151 |
prediction = general_predictor(inputls)
|
| 152 |
|
| 153 |
+
col2.text(f"Your recommendation: {prediction}")
|