yavuzkomecoglu commited on
Commit
f4eff44
1 Parent(s): af48ff2

fixed empty fields check

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -5,9 +5,14 @@ from utils.huggingface_qa import QuestionAnswering
5
  qa = QuestionAnswering()
6
 
7
  def prediction_answer(question, context):
8
- result = qa.prediction(question, context)
 
 
 
9
 
10
- return result["answer"], str(round(result["score"], 5)), result["start"], result["end"]
 
 
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"