kxx-kkk commited on
Commit
e96a8ac
1 Parent(s): 4feffcd

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -27,7 +27,7 @@ def question_answering(context, question):
27
  question_answerer = question_model()
28
  with st.spinner(text="Getting answer..."):
29
  answer = question_answerer(context=context, question=question)
30
- answer_score = answer["score"]
31
  answer = answer["answer"]
32
  # display the result in container
33
  container = st.container(border=True)
@@ -62,7 +62,10 @@ with tab1:
62
  # perform question answering when "get answer" button clicked
63
  button = st.button("Get answer", key="textInput")
64
  if button:
65
- question_answering(context, question)
 
 
 
66
 
67
 
68
  # if upload file as input
 
27
  question_answerer = question_model()
28
  with st.spinner(text="Getting answer..."):
29
  answer = question_answerer(context=context, question=question)
30
+ answer_score = str(answer["score"])
31
  answer = answer["answer"]
32
  # display the result in container
33
  container = st.container(border=True)
 
62
  # perform question answering when "get answer" button clicked
63
  button = st.button("Get answer", key="textInput")
64
  if button:
65
+ if context is not None and question is not None:
66
+ question_answering(context, question)
67
+ else:
68
+ st.warning ("Please enter BOTH the context and the question")
69
 
70
 
71
  # if upload file as input