Aaryan1314 commited on
Commit
74e97fc
·
verified ·
1 Parent(s): 463feee

Update process.py

Browse files
Files changed (1) hide show
  1. process.py +4 -1
process.py CHANGED
@@ -40,5 +40,8 @@ def answer_question_from_chunk(chunks, question):
40
  result = pipe(prompt, max_length=200, temperature=0.7)
41
 
42
  # Return the answer part of the generated result
43
- return result[0]["generated_text"].split("Answer:")[-1].strip()
44
 
 
 
 
 
40
  result = pipe(prompt, max_length=200, temperature=0.7)
41
 
42
  # Return the answer part of the generated result
43
+ answer = result[0]["generated_text"].split("Answer:")[-1].strip()
44
 
45
+ if not answer or answer .lower() in ["i don't know","not found","no answer"]:
46
+ return "No answer found from the document."
47
+ return answer