Spaces:
Sleeping
Sleeping
Commit
·
efdcad5
1
Parent(s):
3b76eef
Update pages/answers.py
Browse files- pages/answers.py +13 -7
pages/answers.py
CHANGED
@@ -64,19 +64,25 @@ def main():
|
|
64 |
|
65 |
if st.button(":blue[**Random Example**]"):
|
66 |
pair = random.choice(pairs)
|
67 |
-
context =
|
68 |
-
question =
|
69 |
-
|
70 |
-
st.write(f"**Context:** {context}")
|
71 |
-
st.write(f"**Question:** {question}")
|
72 |
|
73 |
if st.button(":blue[**Get Answer**]"):
|
74 |
-
|
|
|
|
|
|
|
75 |
st.warning("Please enter the context and question.")
|
76 |
else:
|
77 |
-
answer = get_answer(
|
78 |
st.success(f"Answer: {answer}")
|
79 |
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
if st.button(":blue[**Random Example**]"):
|
66 |
pair = random.choice(pairs)
|
67 |
+
context.text_area("**:blue[Context]**", value=pair['context'])
|
68 |
+
question.text_input("**:blue[Question]**", value=pair['question'])
|
|
|
|
|
|
|
69 |
|
70 |
if st.button(":blue[**Get Answer**]"):
|
71 |
+
context_value = context.text_area("**:blue[Context]**")
|
72 |
+
question_value = question.text_input("**:blue[Question]**")
|
73 |
+
|
74 |
+
if context_value.strip() == "" or question_value.strip() == "":
|
75 |
st.warning("Please enter the context and question.")
|
76 |
else:
|
77 |
+
answer = get_answer(context_value, question_value)
|
78 |
st.success(f"Answer: {answer}")
|
79 |
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
main()
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|