Spaces:
Sleeping
Sleeping
Update classification.py
Browse files- classification.py +2 -2
classification.py
CHANGED
@@ -179,9 +179,9 @@ def match_categories(df, category_df, treshold=0.45):
|
|
179 |
cos_scores = util.cos_sim(ebd_content, torch.stack(list(category_df['Embeddings']), dim=0))[0]
|
180 |
high_score_indices = [i for i, score in enumerate(cos_scores) if score > treshold]
|
181 |
categories_list.append("@~@".join([category_df.loc[index, 'description'] for index in high_score_indices]))
|
182 |
-
experts_list.append("@~@".join(["
|
183 |
topic_list.append("@~@".join([category_df.loc[index, 'topic'] for index in high_score_indices]))
|
184 |
-
scores_list.append("@~@".join(
|
185 |
for j in high_score_indices:
|
186 |
df.loc[index, category_df.loc[j, 'topic']] = float(cos_scores[j])
|
187 |
else:
|
|
|
179 |
cos_scores = util.cos_sim(ebd_content, torch.stack(list(category_df['Embeddings']), dim=0))[0]
|
180 |
high_score_indices = [i for i, score in enumerate(cos_scores) if score > treshold]
|
181 |
categories_list.append("@~@".join([category_df.loc[index, 'description'] for index in high_score_indices]))
|
182 |
+
experts_list.append("@~@".join(["@~@".join(list(set(category_df.loc[index, 'experts']))) for index in high_score_indices]))
|
183 |
topic_list.append("@~@".join([category_df.loc[index, 'topic'] for index in high_score_indices]))
|
184 |
+
scores_list.append("@~@".join([float(cos_scores[index])) for index in high_score_indices])
|
185 |
for j in high_score_indices:
|
186 |
df.loc[index, category_df.loc[j, 'topic']] = float(cos_scores[j])
|
187 |
else:
|