KeshavRa commited on
Commit
d8feb80
Β·
verified Β·
1 Parent(s): fe779b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -17
app.py CHANGED
@@ -187,18 +187,6 @@ if selected_app == "2) Create CSVs":
187
  st.write("You can upload more than one PDF at a time, but don't do too many at once.")
188
  uploaded_files = st.file_uploader("", type="pdf", accept_multiple_files=True)
189
  st.divider()
190
-
191
- st.write("2. Provide instructions for how questions should be generated.")
192
- with st.expander("Explain"):
193
- st.write("You can upload more than one PDF at a time, but don't do too many at once.")
194
- question_protocol = st.text_input("", "Write a question based on the text")
195
-
196
- st.write("3. Provide instructions for how answers should be generated")
197
- with st.expander("Explain"):
198
- st.write("You can upload more than one PDF at a time, but don't do too many at once.")
199
- answer_protocol = st.text_input("", "Write an answer based on the text")
200
-
201
- sentence_chunks = st.number_input("Number sentences per Q/A pair", value=2, step=1, min_value=1, max_value=3)
202
 
203
  openai_api_key = st.text_input("Enter your OpenAI API key", type="password")
204
 
@@ -226,17 +214,15 @@ if selected_app == "2) Create CSVs":
226
  st.rerun()
227
 
228
  with st.spinner("Loading, please be patient with us ... πŸ™"):
229
- textify_output = read_and_textify_advanced(uploaded_files, sentence_chunks)
230
 
231
  df = pd.DataFrame(textify_output)
232
  df.columns = ['context']
233
 
234
- if question_protocol == "":
235
- question_protocol = "Write questions based on the text"
236
  df['questions'] = df.apply(lambda row: get_questions(row['context'], question_protocol), axis=1)
237
 
238
- if answer_protocol == "":
239
- answer_protocol = "Write answers based on the text"
240
  df['answers'] = df.apply(lambda row: get_answers(row, answer_protocol), axis=1)
241
 
242
  df = df.drop('context', axis=1)
 
187
  st.write("You can upload more than one PDF at a time, but don't do too many at once.")
188
  uploaded_files = st.file_uploader("", type="pdf", accept_multiple_files=True)
189
  st.divider()
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  openai_api_key = st.text_input("Enter your OpenAI API key", type="password")
192
 
 
214
  st.rerun()
215
 
216
  with st.spinner("Loading, please be patient with us ... πŸ™"):
217
+ textify_output = read_and_textify_advanced(uploaded_files, 1)
218
 
219
  df = pd.DataFrame(textify_output)
220
  df.columns = ['context']
221
 
222
+ question_protocol = "Write questions based on the text"
 
223
  df['questions'] = df.apply(lambda row: get_questions(row['context'], question_protocol), axis=1)
224
 
225
+ answer_protocol = "Write answers based on the text"
 
226
  df['answers'] = df.apply(lambda row: get_answers(row, answer_protocol), axis=1)
227
 
228
  df = df.drop('context', axis=1)