Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,8 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 10 |
"""
|
| 11 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 12 |
|
|
|
|
|
|
|
| 13 |
class InformationRetrieval():
|
| 14 |
|
| 15 |
def __init__(self, datapath):
|
|
@@ -54,9 +56,12 @@ class InformationRetrieval():
|
|
| 54 |
|
| 55 |
sorted_embeddings = sorted(embeddings_dict.items(), key=lambda item: item[1][1][0][0], reverse=True)
|
| 56 |
|
| 57 |
-
|
| 58 |
for path, (embedding, similarity) in sorted_embeddings:
|
| 59 |
-
print(f"File Path: {path}, Similarity: {similarity[0][0]}")
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
mytextir = InformationRetrieval('data')
|
|
@@ -73,7 +78,7 @@ def respond(
|
|
| 73 |
top_p,
|
| 74 |
):
|
| 75 |
|
| 76 |
-
ir_results = mytextir.
|
| 77 |
|
| 78 |
messages = [{"role": "system", "content": system_message}]
|
| 79 |
|
|
|
|
| 10 |
"""
|
| 11 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 12 |
|
| 13 |
+
|
| 14 |
+
|
| 15 |
class InformationRetrieval():
|
| 16 |
|
| 17 |
def __init__(self, datapath):
|
|
|
|
| 56 |
|
| 57 |
sorted_embeddings = sorted(embeddings_dict.items(), key=lambda item: item[1][1][0][0], reverse=True)
|
| 58 |
|
| 59 |
+
empty_dict = {}
|
| 60 |
for path, (embedding, similarity) in sorted_embeddings:
|
| 61 |
+
#print(f"File Path: {path}, Similarity: {similarity[0][0]}")
|
| 62 |
+
empty_dict[path] =similarity[0][0]
|
| 63 |
+
print(empty_dict)
|
| 64 |
+
return empty_dict
|
| 65 |
|
| 66 |
|
| 67 |
mytextir = InformationRetrieval('data')
|
|
|
|
| 78 |
top_p,
|
| 79 |
):
|
| 80 |
|
| 81 |
+
ir_results = mytextir.model(message)
|
| 82 |
|
| 83 |
messages = [{"role": "system", "content": system_message}]
|
| 84 |
|