Rams901 commited on
Commit
a32a927
1 Parent(s): 0faabd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -51,7 +51,8 @@ def retrieve_thoughts(query, ):
51
  tier_1 = df[df['score'] < 0.85]
52
  tier_2 = df[((df['score'] < 1) * (df["score"] > 0.7))]
53
 
54
- chunks_1 = tier_1.groupby(['title', 'url', ]).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
 
55
  tier_1_adjusted = tier_1.groupby(['title', 'url', ]).first().reset_index()[[ 'title', 'url']]
56
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
57
  tier_1_adjusted['content'] = chunks_1
@@ -63,7 +64,7 @@ def retrieve_thoughts(query, ):
63
  # tier_1 = [doc[0] for doc in docs if ((doc[1] < 1))][:5]
64
  # tier_2 = [doc[0] for doc in docs if ((doc[1] > 0.7)*(doc[1] < 1.5))][10:15]
65
 
66
- return {'tier 1':tier_1_adjusted.loc[:25], 'tier 2': tier_2.loc[:5]}
67
 
68
  def get_references(query):
69
  # TO-DO FINSIH UPP.
 
51
  tier_1 = df[df['score'] < 0.85]
52
  tier_2 = df[((df['score'] < 1) * (df["score"] > 0.7))]
53
 
54
+ tier_1
55
+ chunks_1 = tier_1.groupby(['title', 'url', ]).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values[:min(5, len(x.sort_values('id')['page_content'].values))])).values
56
  tier_1_adjusted = tier_1.groupby(['title', 'url', ]).first().reset_index()[[ 'title', 'url']]
57
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
58
  tier_1_adjusted['content'] = chunks_1
 
64
  # tier_1 = [doc[0] for doc in docs if ((doc[1] < 1))][:5]
65
  # tier_2 = [doc[0] for doc in docs if ((doc[1] > 0.7)*(doc[1] < 1.5))][10:15]
66
 
67
+ return {'tier 1':tier_1_adjusted.loc[:25], 'tier 2': tier_2_adjusted.loc[:5]}
68
 
69
  def get_references(query):
70
  # TO-DO FINSIH UPP.