Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -124,23 +124,23 @@ if 'error' not in st.session_state:
|
|
| 124 |
if 'success' not in st.session_state:
|
| 125 |
st.session_state.success = None
|
| 126 |
|
| 127 |
-
if st.session_state.error != "":
|
| 128 |
-
st.error(st.session_state.error)
|
| 129 |
-
|
| 130 |
-
if st.session_state.success != None:
|
| 131 |
-
st.success("Success! Download the Q/A pairs below / Click reset to upload more PDFs")
|
| 132 |
-
st.download_button(
|
| 133 |
-
label="Download CSV",
|
| 134 |
-
data=st.session_state.success,
|
| 135 |
-
file_name='questions_answers.csv',
|
| 136 |
-
mime='text/csv',
|
| 137 |
-
)
|
| 138 |
-
if st.button('Reset'):
|
| 139 |
-
st.session_state.clear()
|
| 140 |
-
st.rerun()
|
| 141 |
-
|
| 142 |
if selected_app == "1) Create CSVs":
|
| 143 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
uploaded_files = st.file_uploader("Upload PDFs Here", type="pdf", accept_multiple_files=True)
|
| 145 |
|
| 146 |
question_protocol = st.text_input("Provide instructions for how questions should be generated", "Write a question based on the text")
|
|
@@ -200,7 +200,22 @@ if selected_app == "1) Create CSVs":
|
|
| 200 |
st.rerun()
|
| 201 |
|
| 202 |
if selected_app == "2) Merge CSVs":
|
| 203 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
uploaded_files = st.file_uploader("Upload CSV files to merge", accept_multiple_files=True, type="csv")
|
| 205 |
|
| 206 |
submit = st.button("Submit")
|
|
|
|
| 124 |
if 'success' not in st.session_state:
|
| 125 |
st.session_state.success = None
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
if selected_app == "1) Create CSVs":
|
| 128 |
+
if st.session_state.error != "":
|
| 129 |
+
st.error(st.session_state.error)
|
| 130 |
+
|
| 131 |
+
if st.session_state.success != None:
|
| 132 |
+
st.success("Success! Download the Q/A pairs below / Click reset to upload more PDFs")
|
| 133 |
+
st.download_button(
|
| 134 |
+
label="Download CSV",
|
| 135 |
+
data=st.session_state.success,
|
| 136 |
+
file_name='questions_answers.csv',
|
| 137 |
+
mime='text/csv',
|
| 138 |
+
)
|
| 139 |
+
if st.button('Reset'):
|
| 140 |
+
st.session_state.clear()
|
| 141 |
+
st.rerun()
|
| 142 |
+
|
| 143 |
+
else:
|
| 144 |
uploaded_files = st.file_uploader("Upload PDFs Here", type="pdf", accept_multiple_files=True)
|
| 145 |
|
| 146 |
question_protocol = st.text_input("Provide instructions for how questions should be generated", "Write a question based on the text")
|
|
|
|
| 200 |
st.rerun()
|
| 201 |
|
| 202 |
if selected_app == "2) Merge CSVs":
|
| 203 |
+
if st.session_state.error != "":
|
| 204 |
+
st.error(st.session_state.error)
|
| 205 |
+
|
| 206 |
+
if st.session_state.success != None:
|
| 207 |
+
st.success("Success! Download the merged CSV with Q/A pairs below / Reset to merge more CSVs")
|
| 208 |
+
st.download_button(
|
| 209 |
+
label="Download CSV",
|
| 210 |
+
data=st.session_state.success,
|
| 211 |
+
file_name='questions_answers.csv',
|
| 212 |
+
mime='text/csv',
|
| 213 |
+
)
|
| 214 |
+
if st.button('Reset'):
|
| 215 |
+
st.session_state.clear()
|
| 216 |
+
st.rerun()
|
| 217 |
+
|
| 218 |
+
else:
|
| 219 |
uploaded_files = st.file_uploader("Upload CSV files to merge", accept_multiple_files=True, type="csv")
|
| 220 |
|
| 221 |
submit = st.button("Submit")
|