Spaces:
Runtime error
Runtime error
sashavor
commited on
Commit
·
bf75ad9
1
Parent(s):
427730e
attempting to save cluster nums
Browse files
app.py
CHANGED
@@ -30,8 +30,8 @@ df_models = {
|
|
30 |
"Dall-E 2": "DallE",
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
labels_values = sorted(cl_dict.items(), key=operator.itemgetter(1))
|
36 |
labels_values.reverse()
|
37 |
total = float(sum(cl_dict.values()))
|
@@ -125,13 +125,12 @@ def make_profession_table(num_clusters, prof_names, mod_name, max_cols=8):
|
|
125 |
for prof_name, prof_clusters in professions_list_clusters
|
126 |
]
|
127 |
clusters_df = pd.DataFrame.from_dict(prof_list_pre_pandas)
|
128 |
-
return (
|
129 |
-
|
130 |
-
|
|
|
|
|
131 |
)
|
132 |
-
.format(precision=1)
|
133 |
-
.to_html()
|
134 |
-
)
|
135 |
|
136 |
|
137 |
|
@@ -167,20 +166,21 @@ with gr.Blocks() as demo:
|
|
167 |
interactive=True,
|
168 |
)
|
169 |
with gr.Column(scale=3):
|
170 |
-
with gr.Row():
|
171 |
table = gr.HTML(
|
172 |
label="Profession assignment per cluster", wrap=True
|
173 |
-
)
|
|
|
|
|
174 |
for var in [num_clusters, model_choices, profession_choices_overview]:
|
175 |
var.change(
|
176 |
make_profession_table,
|
177 |
[num_clusters, profession_choices_overview, model_choices],
|
178 |
-
table,
|
179 |
queue=False,
|
180 |
)
|
181 |
|
182 |
|
183 |
-
# with gr.Accordion("Tag Frequencies", open=False):
|
184 |
|
185 |
with gr.Tab("Profession Focus"):
|
186 |
with gr.Row():
|
|
|
30 |
"Dall-E 2": "DallE",
|
31 |
}
|
32 |
|
33 |
+
def describe_cluster(num_clusters, block="label"):
|
34 |
+
cl_dict= clusters_dicts[num_clusters]
|
35 |
labels_values = sorted(cl_dict.items(), key=operator.itemgetter(1))
|
36 |
labels_values.reverse()
|
37 |
total = float(sum(cl_dict.values()))
|
|
|
125 |
for prof_name, prof_clusters in professions_list_clusters
|
126 |
]
|
127 |
clusters_df = pd.DataFrame.from_dict(prof_list_pre_pandas)
|
128 |
+
return [c[0] for c in totals], (clusters_df.style.background_gradient(
|
129 |
+
axis=None, vmin=0, vmax=100, cmap="YlGnBu"
|
130 |
+
)
|
131 |
+
.format(precision=1)
|
132 |
+
.to_html()
|
133 |
)
|
|
|
|
|
|
|
134 |
|
135 |
|
136 |
|
|
|
166 |
interactive=True,
|
167 |
)
|
168 |
with gr.Column(scale=3):
|
169 |
+
with gr.Row():
|
170 |
table = gr.HTML(
|
171 |
label="Profession assignment per cluster", wrap=True
|
172 |
+
)
|
173 |
+
#clusters = gr.Dataframe(type="array", visible=False, col_count=1)
|
174 |
+
clusters = gr.Textbox(label='clusters',visible=False)
|
175 |
for var in [num_clusters, model_choices, profession_choices_overview]:
|
176 |
var.change(
|
177 |
make_profession_table,
|
178 |
[num_clusters, profession_choices_overview, model_choices],
|
179 |
+
[clusters, table],
|
180 |
queue=False,
|
181 |
)
|
182 |
|
183 |
|
|
|
184 |
|
185 |
with gr.Tab("Profession Focus"):
|
186 |
with gr.Row():
|