Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
|
|
| 14 |
|
| 15 |
# Create the main function for server
|
| 16 |
def main_func(age, education_num, sex, capital_gain, capital_loss, hours_per_week, salary_class):
|
| 17 |
-
sex =
|
| 18 |
new_row = pd.DataFrame.from_dict({'age':age,
|
| 19 |
'education-num':education_num,'sex':sex,'capital-gain':capital_gain,
|
| 20 |
'capital-loss':capital_loss, 'hours-per-week':hours_per_week,'salary-class':salary_class},
|
|
@@ -61,7 +61,7 @@ with gr.Blocks(title=title) as demo:
|
|
| 61 |
submit_btn = gr.Button("Analyze")
|
| 62 |
|
| 63 |
with gr.Column(visible=True) as output_col:
|
| 64 |
-
label = gr.Label(label="Predicted
|
| 65 |
local_plot = gr.Plot(label="Top SHAP Features")
|
| 66 |
|
| 67 |
submit_btn.click(
|
|
|
|
| 14 |
|
| 15 |
# Create the main function for server
|
| 16 |
def main_func(age, education_num, sex, capital_gain, capital_loss, hours_per_week, salary_class):
|
| 17 |
+
sex = 1 if sex == "Female" else 0
|
| 18 |
new_row = pd.DataFrame.from_dict({'age':age,
|
| 19 |
'education-num':education_num,'sex':sex,'capital-gain':capital_gain,
|
| 20 |
'capital-loss':capital_loss, 'hours-per-week':hours_per_week,'salary-class':salary_class},
|
|
|
|
| 61 |
submit_btn = gr.Button("Analyze")
|
| 62 |
|
| 63 |
with gr.Column(visible=True) as output_col:
|
| 64 |
+
label = gr.Label(label="Predicted Income")
|
| 65 |
local_plot = gr.Plot(label="Top SHAP Features")
|
| 66 |
|
| 67 |
submit_btn.click(
|