Spaces:
Sleeping
Sleeping
Update pages/answers.py
Browse files- pages/answers.py +7 -7
pages/answers.py
CHANGED
@@ -61,24 +61,24 @@ def get_answer(context, question):
|
|
61 |
def main():
|
62 |
st.title("Question Answering App :robot_face:")
|
63 |
st.divider()
|
64 |
-
st.markdown("### **Enter the context and question, then click on ':
|
65 |
|
66 |
-
context = st.text_area("**:
|
67 |
-
question = st.text_input("**:
|
68 |
|
69 |
-
if st.button(":
|
70 |
if context.strip() == "" or question.strip() == "":
|
71 |
st.warning("Please enter the context and question.")
|
72 |
else:
|
73 |
answer = get_answer(context, question)
|
74 |
st.success(f"Answer: {answer}")
|
75 |
|
76 |
-
if st.button(":
|
77 |
pair = random.choice(pairs)
|
78 |
context = pair['context']
|
79 |
question = pair['question']
|
80 |
-
st.text_area("
|
81 |
-
st.text_input("
|
82 |
|
83 |
|
84 |
if __name__ == "__main__":
|
|
|
61 |
def main():
|
62 |
st.title("Question Answering App :robot_face:")
|
63 |
st.divider()
|
64 |
+
st.markdown("### **Enter the context and question, then click on ':blue[Get Answer]' to retrieve the answer:**")
|
65 |
|
66 |
+
context = st.text_area("**:blue[Context]**", "Enter the context here...")
|
67 |
+
question = st.text_input("**:blue[Question]**", "Enter the question here...")
|
68 |
|
69 |
+
if st.button(":blue[**Get Answer**]"):
|
70 |
if context.strip() == "" or question.strip() == "":
|
71 |
st.warning("Please enter the context and question.")
|
72 |
else:
|
73 |
answer = get_answer(context, question)
|
74 |
st.success(f"Answer: {answer}")
|
75 |
|
76 |
+
if st.button(":blue[**Random Example**]"):
|
77 |
pair = random.choice(pairs)
|
78 |
context = pair['context']
|
79 |
question = pair['question']
|
80 |
+
st.text_area(":blue[**Context**]", value=context)
|
81 |
+
st.text_input(":blue[**Question**]", value=question)
|
82 |
|
83 |
|
84 |
if __name__ == "__main__":
|