raghavNCI
commited on
Commit
·
5da06ea
1
Parent(s):
02f3cf9
more print statements
Browse files- question.py +3 -1
question.py
CHANGED
@@ -26,7 +26,7 @@ async def ask_question(input: QuestionInput):
|
|
26 |
|
27 |
# Extract keywords (simple version)
|
28 |
keywords = re.findall(r"\b\w{4,}\b", question)
|
29 |
-
query_string = "+".join(keywords[:
|
30 |
|
31 |
print("Keywords are", query_string);
|
32 |
|
@@ -44,6 +44,8 @@ async def ask_question(input: QuestionInput):
|
|
44 |
for article in articles
|
45 |
])
|
46 |
|
|
|
|
|
47 |
# Build prompt
|
48 |
prompt = f"Context:\n{context}\n\nQuestion: {question}\nAnswer:"
|
49 |
result = qa_model(prompt, max_length=256, do_sample=False)[0]['generated_text']
|
|
|
26 |
|
27 |
# Extract keywords (simple version)
|
28 |
keywords = re.findall(r"\b\w{4,}\b", question)
|
29 |
+
query_string = "+".join(keywords[:8]) # Limit to top 5 keywords
|
30 |
|
31 |
print("Keywords are", query_string);
|
32 |
|
|
|
44 |
for article in articles
|
45 |
])
|
46 |
|
47 |
+
print("And context is", context)
|
48 |
+
|
49 |
# Build prompt
|
50 |
prompt = f"Context:\n{context}\n\nQuestion: {question}\nAnswer:"
|
51 |
result = qa_model(prompt, max_length=256, do_sample=False)[0]['generated_text']
|