Spaces:
Sleeping
Sleeping
Commit
·
ee12eb1
1
Parent(s):
7164e51
Update app.py
Browse files
app.py
CHANGED
@@ -147,8 +147,11 @@ for i in range(row_count):
|
|
147 |
with col2:
|
148 |
question = st.text_input(f'Question {i+1}', key=f'question{i}')
|
149 |
with col3:
|
|
|
|
|
|
|
150 |
answer_placeholder = st.empty()
|
151 |
-
answer_placeholder.text_area(f'Answer {i+1}', key=f'answer{i}')
|
152 |
with col4:
|
153 |
if st.button(f'Submit {i+1}'):
|
154 |
if openAI_key.strip()=='':
|
@@ -163,5 +166,6 @@ for i in range(row_count):
|
|
163 |
load_recommender('corpus.pdf')
|
164 |
|
165 |
answer = generate_answer(question,openAI_key)
|
166 |
-
|
167 |
-
|
|
|
|
147 |
with col2:
|
148 |
question = st.text_input(f'Question {i+1}', key=f'question{i}')
|
149 |
with col3:
|
150 |
+
# Initialize session state for answer if not already done
|
151 |
+
if f'answer{i}' not in st.session_state:
|
152 |
+
st.session_state[f'answer{i}'] = ''
|
153 |
answer_placeholder = st.empty()
|
154 |
+
answer_placeholder.text_area(f'Answer {i+1}', key=f'answer{i}', value=st.session_state[f'answer{i}'])
|
155 |
with col4:
|
156 |
if st.button(f'Submit {i+1}'):
|
157 |
if openAI_key.strip()=='':
|
|
|
166 |
load_recommender('corpus.pdf')
|
167 |
|
168 |
answer = generate_answer(question,openAI_key)
|
169 |
+
# Store the answer in session state
|
170 |
+
st.session_state[f'answer{i}'] = answer
|
171 |
+
answer_placeholder.text_area(f'Answer {i+1}', key=f'answer{i}', value=st.session_state[f'answer{i}'])
|