Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -81,8 +81,7 @@ def preprocess(query: str, k: int) -> tuple[str, str]:
|
|
| 81 |
|
| 82 |
research_abstracts += str(i + i) + ". This excerpt is from: '" + title + "':\n" + text + "\n"
|
| 83 |
references += (
|
| 84 |
-
|
| 85 |
-
+ ". ["
|
| 86 |
+ title.title()
|
| 87 |
+ "]("
|
| 88 |
+ url
|
|
@@ -92,7 +91,7 @@ def preprocess(query: str, k: int) -> tuple[str, str]:
|
|
| 92 |
prompt = prompt.replace("{{ABSTRACTS_GO_HERE}}", research_abstracts)
|
| 93 |
prompt = prompt.replace("{{QUERY_GOES_HERE}}", query)
|
| 94 |
|
| 95 |
-
return prompt, references
|
| 96 |
|
| 97 |
def postprocess(response: str, bypass_from_preprocessing: str) -> str:
|
| 98 |
"""
|
|
|
|
| 81 |
|
| 82 |
research_abstracts += str(i + i) + ". This excerpt is from: '" + title + "':\n" + text + "\n"
|
| 83 |
references += (
|
| 84 |
+
"["
|
|
|
|
| 85 |
+ title.title()
|
| 86 |
+ "]("
|
| 87 |
+ url
|
|
|
|
| 91 |
prompt = prompt.replace("{{ABSTRACTS_GO_HERE}}", research_abstracts)
|
| 92 |
prompt = prompt.replace("{{QUERY_GOES_HERE}}", query)
|
| 93 |
|
| 94 |
+
return prompt, [str(i+1)+". "+ref for ref in list(set(references))]
|
| 95 |
|
| 96 |
def postprocess(response: str, bypass_from_preprocessing: str) -> str:
|
| 97 |
"""
|