edqwd commited on
Commit
d960b7d
ยท
verified ยท
1 Parent(s): d78a2c0

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -0
src/streamlit_app.py CHANGED
@@ -213,6 +213,13 @@ def main():
213
  doc_list.extend(get_text_file(file))
214
  else:
215
  st.error("TXT ํŒŒ์ผ์ด ์•„๋‹™๋‹ˆ๋‹ค.")
 
 
 
 
 
 
 
216
  # CSV ๋ฒ„ํŠผ ๊ตฌํ˜„ ์ฐธ๊ณ  : if file.type == 'text/csv':
217
 
218
  if st.button("Process[CSV]"):
@@ -223,6 +230,13 @@ def main():
223
  doc_list.extend(get_csv_file(file))
224
  else:
225
  st.error("CSV ํŒŒ์ผ์ด ์•„๋‹™๋‹ˆ๋‹ค.")
 
 
 
 
 
 
 
226
  if st.button("Process[JSON]"):
227
  with st.spinner("Processing"):
228
  # get txt text
 
213
  doc_list.extend(get_text_file(file))
214
  else:
215
  st.error("TXT ํŒŒ์ผ์ด ์•„๋‹™๋‹ˆ๋‹ค.")
216
+ if not doc_list:
217
+ st.error("์ฒ˜๋ฆฌ ๊ฐ€๋Šฅํ•œ TXT ๋ฌธ์„œ๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.")
218
+ st.stop()
219
+
220
+ text_chunks = get_text_chunks(doc_list)
221
+ vectorstore = get_vectorstore(text_chunks)
222
+ st.session_state.conversation = get_conversation_chain(vectorstore)
223
  # CSV ๋ฒ„ํŠผ ๊ตฌํ˜„ ์ฐธ๊ณ  : if file.type == 'text/csv':
224
 
225
  if st.button("Process[CSV]"):
 
230
  doc_list.extend(get_csv_file(file))
231
  else:
232
  st.error("CSV ํŒŒ์ผ์ด ์•„๋‹™๋‹ˆ๋‹ค.")
233
+ if not doc_list:
234
+ st.error("์ฒ˜๋ฆฌ ๊ฐ€๋Šฅํ•œ CSV ๋ฌธ์„œ๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.")
235
+ st.stop()
236
+
237
+ text_chunks = get_text_chunks(doc_list)
238
+ vectorstore = get_vectorstore(text_chunks)
239
+ st.session_state.conversation = get_conversation_chain(vectorstore)
240
  if st.button("Process[JSON]"):
241
  with st.spinner("Processing"):
242
  # get txt text