Spaces:
Runtime error
Runtime error
Commit
·
aa4c7fd
1
Parent(s):
0f200d9
Change syntax
Browse files- generator.py +1 -1
generator.py
CHANGED
@@ -89,7 +89,7 @@ def QA(question, context):
|
|
89 |
predict_answer_tokens = inputs.input_ids[0, start : end + 1]
|
90 |
output = tokenizer.decode(predict_answer_tokens, skip_special_tokens=True)
|
91 |
output = string.capwords(output)
|
92 |
-
if
|
93 |
return ""
|
94 |
return f"Q. {question} \n Ans. {output}"
|
95 |
# QA("What was the first C program","The first prgram written in C was Hello World")
|
|
|
89 |
predict_answer_tokens = inputs.input_ids[0, start : end + 1]
|
90 |
output = tokenizer.decode(predict_answer_tokens, skip_special_tokens=True)
|
91 |
output = string.capwords(output)
|
92 |
+
if output.isspace() or len(output) == 0:
|
93 |
return ""
|
94 |
return f"Q. {question} \n Ans. {output}"
|
95 |
# QA("What was the first C program","The first prgram written in C was Hello World")
|