Update app.py
Browse files
app.py
CHANGED
|
@@ -38,6 +38,7 @@ cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
|
| 38 |
|
| 39 |
dataset = load_dataset("sritang/hack_df", split='train')
|
| 40 |
mypassages = list(dataset.to_pandas()['paragraph'])
|
|
|
|
| 41 |
|
| 42 |
dataset_embed = load_dataset("sritang/hack_policy_embed_sri", split='train')
|
| 43 |
dataset_embed_pd = dataset_embed.to_pandas()
|
|
@@ -101,7 +102,7 @@ def get_text_fmt(qry, passages = mypassages, doc_embedding=mycorpus_embeddings):
|
|
| 101 |
prediction_text = []
|
| 102 |
for hit in predictions:
|
| 103 |
page_content = passages[hit['corpus_id']]
|
| 104 |
-
metadata = {"source": hit['corpus_id']}
|
| 105 |
result = Document(page_content=page_content, metadata=metadata)
|
| 106 |
prediction_text.append(result)
|
| 107 |
return prediction_text
|
|
|
|
| 38 |
|
| 39 |
dataset = load_dataset("sritang/hack_df", split='train')
|
| 40 |
mypassages = list(dataset.to_pandas()['paragraph'])
|
| 41 |
+
mysource = list(dataset.to_pandas()['Source'])
|
| 42 |
|
| 43 |
dataset_embed = load_dataset("sritang/hack_policy_embed_sri", split='train')
|
| 44 |
dataset_embed_pd = dataset_embed.to_pandas()
|
|
|
|
| 102 |
prediction_text = []
|
| 103 |
for hit in predictions:
|
| 104 |
page_content = passages[hit['corpus_id']]
|
| 105 |
+
metadata = {"source": mysource[hit['corpus_id']]}
|
| 106 |
result = Document(page_content=page_content, metadata=metadata)
|
| 107 |
prediction_text.append(result)
|
| 108 |
return prediction_text
|