Spaces:
Sleeping
Sleeping
Update app.py
Browse files130 unmodified lines13113213313413513613713849 unmodified lines1881891901911921931941951961971987 unmodified lines20620720820921021121221324 unmodified lines238239240241242243244245246247130 unmodified linesif st.session_state.success != None:st.success("Success! Download the Q/A pairs below / Click reset to upload more PDFs")st.download_button(label="Download CSV",data=st.session_state.success,file_name='questions_answers.csv',mime='text/csv',)49 unmodified linesdf['answers'] = df.apply(lambda row: get_answers(row, answer_protocol), axis=1)df = df.drop('context', axis=1)csv = df.to_csv(index=False).encode('utf-8')st.session_state.clear()st.session_state.success = csvst.rerun()else:st.session_state.clear()7 unmodified linesif st.session_state.success != None:st.success("Success! Download the merged CSV with Q/A pairs below / Reset to merge more CSVs")st.download_button(label="Download CSV",data=st.session_state.success,file_name='questions_answers.csv',mime='text/csv',)24 unmodified linesst.rerun()df = pd.concat(dfs, ignore_index=True)csv = df.to_csv(index=False).encode('utf-8')st.session_state.clear()st.session_state.success = csvst.rerun()else:130 unmodified lines13113213313413513613713849 unmodified lines1881891901911921931941951961971981997 unmodified lines20720820921021121221321424 unmodified lines239240241242243244245246247248249250130 unmodified linesif st.session_state.success != None:st.success("Success! Download the Q/A pairs below / Click reset to upload more PDFs")st.download_button(label=f"Download CSV: length = {st.session_state.success[1]}",data=st.session_state.success[0],file_name='questions_answers.csv',mime='text/csv',)49 unmodified linesdf['answers'] = df.apply(lambda row: get_answers(row, answer_protocol), axis=1)df = df.drop('context', axis=1)length = len(df)csv = df.to_csv(index=False).encode('utf-8')st.session_state.clear()st.session_state.success = (csv, length)st.rerun()else:st.session_state.clear()7 unmodified linesif st.session_state.success != None:st.success("Success! Download the merged CSV with Q/A pairs below / Reset to merge more CSVs")st.download_button(label=f"Download CSV: length = {st.session_state.success[1]}",data=st.session_state.success[0],file_name='questions_answers.csv',mime='text/csv',)24 unmodified linesst.rerun()df = pd.concat(dfs, ignore_index=True)length = len(df)csv = df.to_csv(index=False).encode('utf-8')st.session_state.clear()st.session_state.success = (csv, length)st.rerun()else:
app.py+9-6