Spaces:
Runtime error
Runtime error
Update process.py
Browse files- 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 |
-
|
| 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
|