Spaces:
Runtime error
Runtime error
Commit
·
f8caee2
1
Parent(s):
f7238fe
Update main.py
Browse files
main.py
CHANGED
|
@@ -46,6 +46,8 @@ def filtergpt(text):
|
|
| 46 |
gpt_results = [(law, str(int(article)) if article.is_integer() else str(article)) for law, article in law_article_list]
|
| 47 |
return gpt_results
|
| 48 |
|
|
|
|
|
|
|
| 49 |
def perform_search_and_get_results(collection_name, query, limit=6):
|
| 50 |
search_results = client.search(
|
| 51 |
collection_name=collection_name,
|
|
@@ -59,9 +61,11 @@ def perform_search_and_get_results(collection_name, query, limit=6):
|
|
| 59 |
"La_loi": result.payload["reference"],
|
| 60 |
"Paragraphe": result.payload["paragraph"],
|
| 61 |
"titre": result.payload["titre"],
|
|
|
|
|
|
|
| 62 |
"source": result.payload["source"],
|
| 63 |
"collection": collection_name,
|
| 64 |
-
"hyperlink": result.payload[
|
| 65 |
}
|
| 66 |
resultes.append(result_dict)
|
| 67 |
return resultes
|
|
@@ -79,11 +83,12 @@ def perform_search_and_get_results_with_filter(collection_name, query,reference_
|
|
| 79 |
"Score": result.score,
|
| 80 |
"La_loi": result.payload["reference"],
|
| 81 |
"Paragraphe": result.payload["paragraph"],
|
| 82 |
-
"source": result.payload["source"],
|
| 83 |
"titre": result.payload["titre"],
|
|
|
|
|
|
|
|
|
|
| 84 |
"collection": collection_name,
|
| 85 |
-
"hyperlink": result.payload[
|
| 86 |
-
|
| 87 |
}
|
| 88 |
resultes.append(result_dict)
|
| 89 |
return resultes
|
|
|
|
| 46 |
gpt_results = [(law, str(int(article)) if article.is_integer() else str(article)) for law, article in law_article_list]
|
| 47 |
return gpt_results
|
| 48 |
|
| 49 |
+
import ast
|
| 50 |
+
|
| 51 |
def perform_search_and_get_results(collection_name, query, limit=6):
|
| 52 |
search_results = client.search(
|
| 53 |
collection_name=collection_name,
|
|
|
|
| 61 |
"La_loi": result.payload["reference"],
|
| 62 |
"Paragraphe": result.payload["paragraph"],
|
| 63 |
"titre": result.payload["titre"],
|
| 64 |
+
"section_text": result.payload["section"],
|
| 65 |
+
"section_label": result.payload["section_label"],
|
| 66 |
"source": result.payload["source"],
|
| 67 |
"collection": collection_name,
|
| 68 |
+
"hyperlink": ast.literal_eval(result.payload['hyperlink']),
|
| 69 |
}
|
| 70 |
resultes.append(result_dict)
|
| 71 |
return resultes
|
|
|
|
| 83 |
"Score": result.score,
|
| 84 |
"La_loi": result.payload["reference"],
|
| 85 |
"Paragraphe": result.payload["paragraph"],
|
|
|
|
| 86 |
"titre": result.payload["titre"],
|
| 87 |
+
"section_text": result.payload["section"],
|
| 88 |
+
"section_label": result.payload["section_label"],
|
| 89 |
+
"source": result.payload["source"],
|
| 90 |
"collection": collection_name,
|
| 91 |
+
"hyperlink": ast.literal_eval(result.payload['hyperlink']),
|
|
|
|
| 92 |
}
|
| 93 |
resultes.append(result_dict)
|
| 94 |
return resultes
|