Update app.py
Browse files
app.py
CHANGED
@@ -53,8 +53,9 @@ def retrieve_thoughts(query, n):
|
|
53 |
|
54 |
# TO-DO: What if user query doesn't match what we provide as documents
|
55 |
|
56 |
-
tier_1 = df[df['score'] < 0.
|
57 |
-
|
|
|
58 |
|
59 |
|
60 |
chunks_1 = tier_1.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
|
@@ -62,9 +63,9 @@ def retrieve_thoughts(query, n):
|
|
62 |
tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
|
63 |
tier_1_adjusted['content'] = chunks_1
|
64 |
|
65 |
-
chunks_2 = tier_2.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
|
66 |
-
tier_2_adjusted = tier_2.groupby(['title', 'url', '_id']).first().reset_index()[['_id', 'title', 'url']]
|
67 |
-
tier_2_adjusted['content'] = chunks_2
|
68 |
|
69 |
if n:
|
70 |
tier_1_adjusted = tier_1_adjusted[:min(len(tier_1_adjusted), n)]
|
|
|
53 |
|
54 |
# TO-DO: What if user query doesn't match what we provide as documents
|
55 |
|
56 |
+
tier_1 = df[df['score'] < 0.95]
|
57 |
+
tier_1 = tier_1[:min(len(tier_1),150)]
|
58 |
+
# tier_2 = df[(df['score'] < 0.95) * (df["score"] > 0.7)]
|
59 |
|
60 |
|
61 |
chunks_1 = tier_1.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
|
|
|
63 |
tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
|
64 |
tier_1_adjusted['content'] = chunks_1
|
65 |
|
66 |
+
# chunks_2 = tier_2.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
|
67 |
+
# tier_2_adjusted = tier_2.groupby(['title', 'url', '_id']).first().reset_index()[['_id', 'title', 'url']]
|
68 |
+
# tier_2_adjusted['content'] = chunks_2
|
69 |
|
70 |
if n:
|
71 |
tier_1_adjusted = tier_1_adjusted[:min(len(tier_1_adjusted), n)]
|