Upload app_federal.py
Browse files- app_federal.py +4 -2
app_federal.py
CHANGED
@@ -205,6 +205,8 @@ def register_review(history, additional_feedback, response_json):
|
|
205 |
"additional_feedback": additional_feedback
|
206 |
}
|
207 |
|
|
|
|
|
208 |
with scheduler.lock:
|
209 |
with JSON_DATASET_PATH.open("a") as f:
|
210 |
json.dump(res, f)
|
@@ -289,7 +291,7 @@ def run_retrieval(query):
|
|
289 |
|
290 |
query_embeddings = run_dense_retrieval(query)
|
291 |
#query_embeddings = pca_model.transform(query_embeddings)
|
292 |
-
D, I = faiss_index.search(query_embeddings,
|
293 |
scores_embeddings = list(D[0])
|
294 |
indices_embeddings = I[0]
|
295 |
indices_embeddings = [int(i) for i in indices_embeddings]
|
@@ -326,7 +328,7 @@ def run_retrieval(query):
|
|
326 |
item["metadata_reranking"] = ""
|
327 |
out_dict.append(item)
|
328 |
print ("out_dict_before_reranking")
|
329 |
-
print (out_dict[:50])
|
330 |
out_dict = rerank_with_chatGPT(query, out_dict)[:NUM_RESULTS]
|
331 |
print ("RETURNING OUT DICT")
|
332 |
return out_dict
|
|
|
205 |
"additional_feedback": additional_feedback
|
206 |
}
|
207 |
|
208 |
+
# ok, have to add some things, but should be easy
|
209 |
+
|
210 |
with scheduler.lock:
|
211 |
with JSON_DATASET_PATH.open("a") as f:
|
212 |
json.dump(res, f)
|
|
|
291 |
|
292 |
query_embeddings = run_dense_retrieval(query)
|
293 |
#query_embeddings = pca_model.transform(query_embeddings)
|
294 |
+
D, I = faiss_index.search(query_embeddings, 45)
|
295 |
scores_embeddings = list(D[0])
|
296 |
indices_embeddings = I[0]
|
297 |
indices_embeddings = [int(i) for i in indices_embeddings]
|
|
|
328 |
item["metadata_reranking"] = ""
|
329 |
out_dict.append(item)
|
330 |
print ("out_dict_before_reranking")
|
331 |
+
#print (out_dict[:50])
|
332 |
out_dict = rerank_with_chatGPT(query, out_dict)[:NUM_RESULTS]
|
333 |
print ("RETURNING OUT DICT")
|
334 |
return out_dict
|