Commit
·
33cc46f
1
Parent(s):
9132037
Update app.py
Browse files
app.py
CHANGED
@@ -55,9 +55,8 @@ def compare_text(transcript, categories, threshold):
|
|
55 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
56 |
# Categories
|
57 |
df_category_list = process_categories(categories)
|
58 |
-
df_cosines = pd.DataFrame()
|
59 |
df_results = pd.DataFrame(columns=['line', 'sentence', 'phrase', 'category', 'similarity'])
|
60 |
-
# df_cosines['line'] += 1
|
61 |
for _, df_category in enumerate(df_category_list):
|
62 |
df_category.reset_index(drop=True, inplace=True)
|
63 |
phrases_list = df_category["embeddings"].values.tolist()
|
@@ -77,7 +76,7 @@ def compare_text(transcript, categories, threshold):
|
|
77 |
}
|
78 |
df_results = df_results.append(new_row, ignore_index=True)
|
79 |
|
80 |
-
|
81 |
df_results = df_results.sort_values(['line','similarity'],ascending=[True,False]).round(decimals = 3)
|
82 |
|
83 |
df_summary = pd.DataFrame(df_cosines.max(numeric_only=True),columns=['similarity'])
|
@@ -103,7 +102,7 @@ def compare_text(transcript, categories, threshold):
|
|
103 |
df_results = df_results.round(decimals = 3)
|
104 |
df_summary = df_summary['similarity'].round(decimals = 2)
|
105 |
|
106 |
-
return df_summary.to_dict(), fig,
|
107 |
|
108 |
categories = """Hello=Hello, how are you doing today?;Hi, everybody;Hi;My name's Johnny
|
109 |
What=most advanced conversation intelligence and AI powered coaching platform;a software platform that helps people reach their potential;for communicating and connecting;empowered by behavioral science;uses artificial intelligence;drives performance outcomes for customer facing teams;help them sell more;help them deliver better experiences
|
|
|
55 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
56 |
# Categories
|
57 |
df_category_list = process_categories(categories)
|
58 |
+
df_cosines = pd.DataFrame(sentences, columns=['sentence'],index=list(range(1,len(sentences)+1)))
|
59 |
df_results = pd.DataFrame(columns=['line', 'sentence', 'phrase', 'category', 'similarity'])
|
|
|
60 |
for _, df_category in enumerate(df_category_list):
|
61 |
df_category.reset_index(drop=True, inplace=True)
|
62 |
phrases_list = df_category["embeddings"].values.tolist()
|
|
|
76 |
}
|
77 |
df_results = df_results.append(new_row, ignore_index=True)
|
78 |
|
79 |
+
df_cosines = df_cosines.round(decimals = 3)
|
80 |
df_results = df_results.sort_values(['line','similarity'],ascending=[True,False]).round(decimals = 3)
|
81 |
|
82 |
df_summary = pd.DataFrame(df_cosines.max(numeric_only=True),columns=['similarity'])
|
|
|
102 |
df_results = df_results.round(decimals = 3)
|
103 |
df_summary = df_summary['similarity'].round(decimals = 2)
|
104 |
|
105 |
+
return df_summary.to_dict(), fig, df_cosines, df_results
|
106 |
|
107 |
categories = """Hello=Hello, how are you doing today?;Hi, everybody;Hi;My name's Johnny
|
108 |
What=most advanced conversation intelligence and AI powered coaching platform;a software platform that helps people reach their potential;for communicating and connecting;empowered by behavioral science;uses artificial intelligence;drives performance outcomes for customer facing teams;help them sell more;help them deliver better experiences
|