Spaces:
Sleeping
Sleeping
Update app.py
Browse files172 unmodified lines173174175176177178179180181182183184185186187188189190191192193194195196197198199200172 unmodified linesst.session_state.success = Nonest.session_state.submit = Falsest.rerun()textify_output = read_and_textify_advanced(uploaded_files, sentence_chunks)df = pd.DataFrame(textify_output)df.columns = ['context']if question_protocol == "":question_protocol = "Write questions based on the text"df['questions'] = df.apply(lambda row: get_questions(row['context'], question_protocol), axis=1)if answer_protocol == "":answer_protocol = "Write answers based on the text"df['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.error = ""st.session_state.success = csvst.session_state.submit = Falsest.rerun()else:st.session_state.error = "Please upload at least 1 PDF"st.session_state.success = None172 unmodified lines173174175176177178179180181182183184185186187188189190191192193194195196197198199200201172 unmodified linesst.session_state.success = Nonest.session_state.submit = Falsest.rerun()with st.spinner("Loading, please be patient with us ... 🙏"):textify_output = read_and_textify_advanced(uploaded_files, sentence_chunks)df = pd.DataFrame(textify_output)df.columns = ['context']if question_protocol == "":question_protocol = "Write questions based on the text"df['questions'] = df.apply(lambda row: get_questions(row['context'], question_protocol), axis=1)if answer_protocol == "":answer_protocol = "Write answers based on the text"df['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.error = ""st.session_state.success = csvst.session_state.submit = Falsest.rerun()else:st.session_state.error = "Please upload at least 1 PDF"st.session_state.success = None
app.py+21-20