Spaces:
Running
Running
Update app.py
Browse filesdebugging file uploader
app.py
CHANGED
@@ -111,10 +111,10 @@ with tab1:
|
|
111 |
with tab2:
|
112 |
# provide upload place
|
113 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt","pdf"])
|
114 |
-
|
115 |
# Get the initial values of context and question
|
116 |
-
|
117 |
-
|
118 |
|
119 |
# transfer file to context and allow ask question, then perform question answering
|
120 |
if uploaded_file is not None:
|
@@ -129,8 +129,8 @@ with tab2:
|
|
129 |
raw_text = extract_text(temp_file.name)
|
130 |
text = str(raw_text)
|
131 |
|
132 |
-
|
133 |
-
|
134 |
|
135 |
# perform question answering when "get answer" button clicked
|
136 |
button2 = st.button("Get answer", key="fileInput")
|
|
|
111 |
with tab2:
|
112 |
# provide upload place
|
113 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt","pdf"])
|
114 |
+
|
115 |
# Get the initial values of context and question
|
116 |
+
context2 = st.session_state.get("contextInput2", "")
|
117 |
+
question2 = st.session_state.get("questionInput2", "")
|
118 |
|
119 |
# transfer file to context and allow ask question, then perform question answering
|
120 |
if uploaded_file is not None:
|
|
|
129 |
raw_text = extract_text(temp_file.name)
|
130 |
text = str(raw_text)
|
131 |
|
132 |
+
question2 = st.text_input(label="Enter your question", key="questionInput2")
|
133 |
+
context2 = st.text_area("Your essay context: ", value=text, height=330, key="contextInput2")
|
134 |
|
135 |
# perform question answering when "get answer" button clicked
|
136 |
button2 = st.button("Get answer", key="fileInput")
|