awacke1 commited on
Commit
7066b5d
·
1 Parent(s): 42b6032

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -355,10 +355,12 @@ with st.sidebar:
355
  docs = st.file_uploader("Upload your documents", accept_multiple_files=True)
356
  with st.spinner("Processing"):
357
  raw = extract_text_from_pdfs(docs)
358
- text_chunks = split_text_into_chunks(raw)
359
- vectorstore = create_vector_store_from_text_chunks(text_chunks)
360
- st.session_state.conversation = create_conversation_chain(vectorstore)
361
- length = str(len(raw))
362
- st.markdown('# Extracted Text of Length:' + length + ' and Created Search Index')
363
- filename = generate_filename(raw, choice)
364
- create_file(filename, raw_text, '')
 
 
 
355
  docs = st.file_uploader("Upload your documents", accept_multiple_files=True)
356
  with st.spinner("Processing"):
357
  raw = extract_text_from_pdfs(docs)
358
+ if len(raw) > 0:
359
+ length = str(len(raw))
360
+ text_chunks = split_text_into_chunks(raw)
361
+ vectorstore = create_vector_store_from_text_chunks(text_chunks)
362
+ st.session_state.conversation = create_conversation_chain(vectorstore)
363
+ st.markdown('# Extracted Text of Length:' + length + ' and Created Search Index')
364
+ filename = generate_filename(raw, choice)
365
+ create_file(filename, raw_text, '')
366
+