Spaces:
Runtime error
Runtime error
Commit
·
f4eff44
1
Parent(s):
af48ff2
fixed empty fields check
Browse files
app.py
CHANGED
|
@@ -5,9 +5,14 @@ from utils.huggingface_qa import QuestionAnswering
|
|
| 5 |
qa = QuestionAnswering()
|
| 6 |
|
| 7 |
def prediction_answer(question, context):
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
title = "Turkish Question Answering"
|
| 13 |
description = "Enter context and question"
|
|
|
|
| 5 |
qa = QuestionAnswering()
|
| 6 |
|
| 7 |
def prediction_answer(question, context):
|
| 8 |
+
print("question", question)
|
| 9 |
+
print("context", context)
|
| 10 |
+
if question!="" and context!="":
|
| 11 |
+
result = qa.prediction(question, context)
|
| 12 |
|
| 13 |
+
return result["answer"], str(round(result["score"], 5)), result["start"], result["end"]
|
| 14 |
+
else:
|
| 15 |
+
return "-", 0, -1, -1
|
| 16 |
|
| 17 |
title = "Turkish Question Answering"
|
| 18 |
description = "Enter context and question"
|