Spaces:
Build error
Build error
rkoushikroy2
commited on
Commit
•
5e22d67
1
Parent(s):
a4b9f57
Update helper_functions.py
Browse files- helper_functions.py +1 -0
helper_functions.py
CHANGED
@@ -31,6 +31,7 @@ def search(df, query, max_n, max_token):
|
|
31 |
)
|
32 |
df["similarity"] = df.ada_embedding.apply(lambda x: cosine_similarity(x, query_embedding))
|
33 |
df = df.sort_values("similarity", ascending=False).head(max_n)
|
|
|
34 |
df["cumulative_sum"] = df.token.cumsum()
|
35 |
return '\n\n'.join(df[(df['cumulative_sum'] < max_token)]["combined_summarised"])
|
36 |
|
|
|
31 |
)
|
32 |
df["similarity"] = df.ada_embedding.apply(lambda x: cosine_similarity(x, query_embedding))
|
33 |
df = df.sort_values("similarity", ascending=False).head(max_n)
|
34 |
+
df = df[df['similarity'] >= .77]
|
35 |
df["cumulative_sum"] = df.token.cumsum()
|
36 |
return '\n\n'.join(df[(df['cumulative_sum'] < max_token)]["combined_summarised"])
|
37 |
|