Daoneeee commited on
Commit
62f948e
·
1 Parent(s): 0db9945

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -125,25 +125,36 @@ def main():
125
  st.subheader("Your documents")
126
  docs = st.file_uploader(
127
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
128
- # 'Process' 버튼 블록 내에서
129
  if st.button("Process"):
130
  with st.spinner("Processing"):
 
131
  doc_list = []
132
 
133
  for file in docs:
 
134
  if file.type == 'text/plain':
 
135
  doc_list.extend(get_text_file(file))
136
  elif file.type in ['application/octet-stream', 'application/pdf']:
 
137
  doc_list.extend(get_pdf_text(file))
138
  elif file.type == 'text/csv':
 
139
  doc_list.extend(get_csv_file(file))
140
  elif file.type == 'application/json':
 
141
  doc_list.extend(get_json_file(file))
142
 
 
143
  text_chunks = get_text_chunks(doc_list)
 
 
144
  vectorstore = get_vectorstore(text_chunks)
145
- st.session_state.conversation = get_conversation_chain(vectorstore)
 
 
 
146
 
147
 
148
  if __name__ == '__main__':
149
- main()
 
125
  st.subheader("Your documents")
126
  docs = st.file_uploader(
127
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
 
128
  if st.button("Process"):
129
  with st.spinner("Processing"):
130
+ # get pdf text
131
  doc_list = []
132
 
133
  for file in docs:
134
+ print('file - type : ', file.type)
135
  if file.type == 'text/plain':
136
+ # file is .txt
137
  doc_list.extend(get_text_file(file))
138
  elif file.type in ['application/octet-stream', 'application/pdf']:
139
+ # file is .pdf
140
  doc_list.extend(get_pdf_text(file))
141
  elif file.type == 'text/csv':
142
+ # file is .csv
143
  doc_list.extend(get_csv_file(file))
144
  elif file.type == 'application/json':
145
+ # file is .json
146
  doc_list.extend(get_json_file(file))
147
 
148
+ # get the text chunks
149
  text_chunks = get_text_chunks(doc_list)
150
+
151
+ # create vector store
152
  vectorstore = get_vectorstore(text_chunks)
153
+
154
+ # create conversation chain
155
+ st.session_state.conversation = get_conversation_chain(
156
+ vectorstore)
157
 
158
 
159
  if __name__ == '__main__':
160
+ main()