Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-12-v2')
|
|
25 |
def display_df_as_table(model,top_k,score='score'):
|
26 |
# Display the df with text and scores as a table
|
27 |
df = pd.DataFrame([(hit[score],passages[hit['corpus_id']]) for hit in model[0:top_k]],columns=['Score','Text'])
|
28 |
-
df['Score'] = round(df['Score'],2)
|
29 |
df = df.merge(netflix_df,how='inner',left_on='Text',right_on='description')
|
30 |
df.drop('Text',inplace=True,axis=1)
|
31 |
|
@@ -56,6 +56,8 @@ def semantic_search(query,top_k):
|
|
56 |
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
57 |
cross_df = display_df_as_table(hits,top_k,'cross-score')
|
58 |
|
|
|
|
|
59 |
return bi_df, cross_df
|
60 |
|
61 |
|
|
|
25 |
def display_df_as_table(model,top_k,score='score'):
|
26 |
# Display the df with text and scores as a table
|
27 |
df = pd.DataFrame([(hit[score],passages[hit['corpus_id']]) for hit in model[0:top_k]],columns=['Score','Text'])
|
28 |
+
df['Score'] = round(df['Score'].astype(float),2)
|
29 |
df = df.merge(netflix_df,how='inner',left_on='Text',right_on='description')
|
30 |
df.drop('Text',inplace=True,axis=1)
|
31 |
|
|
|
56 |
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
57 |
cross_df = display_df_as_table(hits,top_k,'cross-score')
|
58 |
|
59 |
+
cross_df['Score'] = round(cross_df['Score'].astype(float),2)
|
60 |
+
|
61 |
return bi_df, cross_df
|
62 |
|
63 |
|