Spaces:
Runtime error
Runtime error
sashavor commited on
Commit ·
a1e3eb9
1
Parent(s): 6477694
trying html
Browse files
app.py
CHANGED
|
@@ -68,13 +68,11 @@ def make_profession_plot(num_clusters, prof_name):
|
|
| 68 |
def make_profession_table(num_clusters, prof_names, mod_name):
|
| 69 |
cl_df = clusters_by_size[num_clusters]
|
| 70 |
clusters_df = cl_df[df_models[mod_name]].apply(pd.Series).loc[prof_names]['cluster_proportions'].apply(pd.Series).reset_index().rename(columns={"index":"profession"}).round(1)
|
|
|
|
| 71 |
labor_df = cl_df[df_models[mod_name]].apply(pd.Series).loc[prof_names]['labor_fm'].apply(pd.Series).rename(columns={0:"female", 1:"male"}).reset_index().rename(columns={"index":"profession"}).round(1)
|
|
|
|
| 72 |
return clusters_df, labor_df
|
| 73 |
-
|
| 74 |
-
# print(mod_names)
|
| 75 |
-
# mod_df = pd.DataFrame(cl_df[df_models[mod_names]])
|
| 76 |
-
# print(mod_df.head(5))
|
| 77 |
-
# return mod_df
|
| 78 |
|
| 79 |
|
| 80 |
with gr.Blocks() as demo:
|
|
@@ -101,11 +99,11 @@ with gr.Blocks() as demo:
|
|
| 101 |
interactive=True,
|
| 102 |
)
|
| 103 |
with gr.Row():
|
| 104 |
-
table = gr.
|
| 105 |
label="Profession assignment per cluster", wrap=True
|
| 106 |
)
|
| 107 |
with gr.Row():
|
| 108 |
-
labor_table = gr.
|
| 109 |
label="Labor Bureau Statistics per profession", wrap=True
|
| 110 |
)
|
| 111 |
num_clusters.change(
|
|
|
|
| 68 |
def make_profession_table(num_clusters, prof_names, mod_name):
|
| 69 |
cl_df = clusters_by_size[num_clusters]
|
| 70 |
clusters_df = cl_df[df_models[mod_name]].apply(pd.Series).loc[prof_names]['cluster_proportions'].apply(pd.Series).reset_index().rename(columns={"index":"profession"}).round(1)
|
| 71 |
+
clusters_df.style.background_gradient(cmap='Blues').to_html()
|
| 72 |
labor_df = cl_df[df_models[mod_name]].apply(pd.Series).loc[prof_names]['labor_fm'].apply(pd.Series).rename(columns={0:"female", 1:"male"}).reset_index().rename(columns={"index":"profession"}).round(1)
|
| 73 |
+
labor_df.style.background_gradient(cmap='Blues').to_html()
|
| 74 |
return clusters_df, labor_df
|
| 75 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
|
| 78 |
with gr.Blocks() as demo:
|
|
|
|
| 99 |
interactive=True,
|
| 100 |
)
|
| 101 |
with gr.Row():
|
| 102 |
+
table = gr.HTML(
|
| 103 |
label="Profession assignment per cluster", wrap=True
|
| 104 |
)
|
| 105 |
with gr.Row():
|
| 106 |
+
labor_table = gr.HTML(
|
| 107 |
label="Labor Bureau Statistics per profession", wrap=True
|
| 108 |
)
|
| 109 |
num_clusters.change(
|