Spaces:
Sleeping
Sleeping
Isabel Gwara
commited on
Commit
·
8baa7c2
1
Parent(s):
9310b2e
Update app.py
Browse files
app.py
CHANGED
@@ -118,20 +118,7 @@ def general_predictor(*args):
|
|
118 |
return cat_value_dicts[final_colname][result[0]]
|
119 |
|
120 |
# add data labels to replace those lost via star-args
|
121 |
-
inputls = []
|
122 |
-
for colname in data.columns:
|
123 |
-
# skip last column
|
124 |
-
if colname == final_colname:
|
125 |
-
continue
|
126 |
|
127 |
-
# access categories dict if data is categorical
|
128 |
-
# otherwise, just use a number input
|
129 |
-
if colname in cat_value_dicts:
|
130 |
-
radio_options = list(cat_value_dicts[colname].keys())
|
131 |
-
inputls.append(gr.inputs.Dropdown(choices=radio_options, type="value", label=colname))
|
132 |
-
else:
|
133 |
-
# add numerical input
|
134 |
-
inputls.append(gr.inputs.Number(label=colname))
|
135 |
|
136 |
block = gr.Blocks()
|
137 |
|
@@ -139,10 +126,26 @@ with open('info.md') as f:
|
|
139 |
with block:
|
140 |
gr.Markdown(f.readline())
|
141 |
gr.Markdown('Take the quiz to get a personalized recommendation using AI.')
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
# show the interface
|
148 |
block.launch()
|
|
|
118 |
return cat_value_dicts[final_colname][result[0]]
|
119 |
|
120 |
# add data labels to replace those lost via star-args
|
|
|
|
|
|
|
|
|
|
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
block = gr.Blocks()
|
124 |
|
|
|
126 |
with block:
|
127 |
gr.Markdown(f.readline())
|
128 |
gr.Markdown('Take the quiz to get a personalized recommendation using AI.')
|
129 |
+
|
130 |
+
inputls = []
|
131 |
+
for colname in data.columns:
|
132 |
+
# skip last column
|
133 |
+
if colname == final_colname:
|
134 |
+
continue
|
135 |
+
|
136 |
+
# access categories dict if data is categorical
|
137 |
+
# otherwise, just use a number input
|
138 |
+
if colname in cat_value_dicts:
|
139 |
+
radio_options = list(cat_value_dicts[colname].keys())
|
140 |
+
inputls.append(gr.inputs.Dropdown(choices=radio_options, type="value", label=colname))
|
141 |
+
else:
|
142 |
+
# add numerical input
|
143 |
+
inputls.append(gr.inputs.Number(label=colname))
|
144 |
+
|
145 |
+
output = gr.Text()
|
146 |
+
|
147 |
+
submit = gr.Button("Submit")
|
148 |
+
submit.click(fn=general_predictor, inputs=inputls, outputs=ouput)
|
149 |
|
150 |
# show the interface
|
151 |
block.launch()
|