Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -69,7 +69,7 @@ def preprocess(query: str, k: int) -> tuple[str, str]:
|
|
69 |
"ANSWER:\n"
|
70 |
)
|
71 |
|
72 |
-
references = "
|
73 |
research_abstracts = ""
|
74 |
|
75 |
for i in range(k):
|
@@ -80,7 +80,7 @@ def preprocess(query: str, k: int) -> tuple[str, str]:
|
|
80 |
text = top_five["text"].values[i]
|
81 |
|
82 |
research_abstracts += str(i + i) + ". This excerpt is from: '" + title + "':\n" + text + "\n"
|
83 |
-
references
|
84 |
"["
|
85 |
+ title.title()
|
86 |
+ "]("
|
@@ -91,7 +91,7 @@ def preprocess(query: str, k: int) -> tuple[str, str]:
|
|
91 |
prompt = prompt.replace("{{ABSTRACTS_GO_HERE}}", research_abstracts)
|
92 |
prompt = prompt.replace("{{QUERY_GOES_HERE}}", query)
|
93 |
|
94 |
-
return prompt, "\n".join([str(i+1)+". "+ref for ref in list(set(references))])
|
95 |
|
96 |
def postprocess(response: str, bypass_from_preprocessing: str) -> str:
|
97 |
"""
|
|
|
69 |
"ANSWER:\n"
|
70 |
)
|
71 |
|
72 |
+
references = ""
|
73 |
research_abstracts = ""
|
74 |
|
75 |
for i in range(k):
|
|
|
80 |
text = top_five["text"].values[i]
|
81 |
|
82 |
research_abstracts += str(i + i) + ". This excerpt is from: '" + title + "':\n" + text + "\n"
|
83 |
+
references.append(
|
84 |
"["
|
85 |
+ title.title()
|
86 |
+ "]("
|
|
|
91 |
prompt = prompt.replace("{{ABSTRACTS_GO_HERE}}", research_abstracts)
|
92 |
prompt = prompt.replace("{{QUERY_GOES_HERE}}", query)
|
93 |
|
94 |
+
return prompt, "\n\n## References\n\n"+"\n".join([str(i+1)+". "+ref for ref in list(set(references))])
|
95 |
|
96 |
def postprocess(response: str, bypass_from_preprocessing: str) -> str:
|
97 |
"""
|