Spaces:
Sleeping
Sleeping
Isabel Gwara
commited on
Commit
·
6b53e3b
1
Parent(s):
a5b4e81
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,25 +127,32 @@ with open('info.md') as f:
|
|
| 127 |
gr.Markdown("###" + f.readline())
|
| 128 |
gr.Markdown('Take the quiz to get a personalized recommendation using AI.')
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
# show the interface
|
| 151 |
block.launch()
|
|
|
|
| 127 |
gr.Markdown("###" + f.readline())
|
| 128 |
gr.Markdown('Take the quiz to get a personalized recommendation using AI.')
|
| 129 |
|
| 130 |
+
with gr.Row():
|
| 131 |
+
with gr.Box():
|
| 132 |
+
inputls = []
|
| 133 |
+
for colname in data.columns:
|
| 134 |
+
# skip last column
|
| 135 |
+
if colname == final_colname:
|
| 136 |
+
continue
|
| 137 |
+
|
| 138 |
+
# access categories dict if data is categorical
|
| 139 |
+
# otherwise, just use a number input
|
| 140 |
+
if colname in cat_value_dicts:
|
| 141 |
+
radio_options = list(cat_value_dicts[colname].keys())
|
| 142 |
+
inputls.append(gr.inputs.Dropdown(choices=radio_options, type="value", label=colname))
|
| 143 |
+
else:
|
| 144 |
+
# add numerical input
|
| 145 |
+
inputls.append(gr.inputs.Number(label=colname))
|
| 146 |
+
|
| 147 |
+
output = gr.Text()
|
| 148 |
+
|
| 149 |
+
submit = gr.Button("Submit")
|
| 150 |
+
submit.click(fn=general_predictor, inputs=inputls, outputs=output)
|
| 151 |
+
|
| 152 |
+
with gr.Box():
|
| 153 |
+
with open('info.md') as f:
|
| 154 |
+
f.readline()
|
| 155 |
+
gr.Markdown(f.read())
|
| 156 |
|
| 157 |
# show the interface
|
| 158 |
block.launch()
|