Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ st.write("Extractive question answering is a Natural Language Processing task wh
|
|
11 |
# st.markdown('___')
|
12 |
|
13 |
# store the model in cache resources to enhance efficiency
|
|
|
14 |
@st.cache_resource(show_spinner=True)
|
15 |
def question_model():
|
16 |
# call my model for question answering
|
@@ -30,12 +31,14 @@ with tab1:
|
|
30 |
sample_text = text_file.read()
|
31 |
|
32 |
example = st.button("Try example")
|
33 |
-
|
34 |
-
|
|
|
|
|
35 |
if example:
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
button = st.button("Get answer")
|
40 |
if button:
|
41 |
with st.spinner(text="Loading question model..."):
|
|
|
11 |
# st.markdown('___')
|
12 |
|
13 |
# store the model in cache resources to enhance efficiency
|
14 |
+
# ref: https://docs.streamlit.io/library/advanced-features/caching
|
15 |
@st.cache_resource(show_spinner=True)
|
16 |
def question_model():
|
17 |
# call my model for question answering
|
|
|
31 |
sample_text = text_file.read()
|
32 |
|
33 |
example = st.button("Try example")
|
34 |
+
|
35 |
+
context = st.text_area("Enter the essay below:", key="context", height=330)
|
36 |
+
question = st.text_input(label="Enter the question: ", key="question")
|
37 |
+
|
38 |
if example:
|
39 |
+
st.session_state.context = sample_text
|
40 |
+
st.session_state.question = sample_question
|
41 |
+
|
42 |
button = st.button("Get answer")
|
43 |
if button:
|
44 |
with st.spinner(text="Loading question model..."):
|