DDingcheol commited on
Commit
6edfa7e
ยท
1 Parent(s): ff7260e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -37,10 +37,12 @@ def get_text_file(docs):
37
  text_list.append(text)
38
 
39
  # ์ฃผ์–ด์ง„ ํŒŒ์ผ ๋ชฉ๋ก์„ ๋ฐ˜๋ณตํ•˜๋ฉด์„œ ๊ฐ ํŒŒ์ผ์„ ์ฒ˜๋ฆฌ
40
- for filename, file_content in docs:
41
- if filename.lower().endswith('.txt'): # ํŒŒ์ผ ํ™•์žฅ์ž ํ™•์ธ
42
- bytes_file = BytesIO(file_content.encode()) # BytesIO๋กœ ๋ณ€ํ™˜
43
- process_txt_file(bytes_file.getvalue()) # .txt ํŒŒ์ผ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ ํ˜ธ์ถœ
 
 
44
 
45
  # ๋‹ค๋ฅธ ํŒŒ์ผ ์œ ํ˜•(PDF, CSV, JSON ๋“ฑ)์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ
46
  # ํ•„์š”ํ•˜๋‹ค๋ฉด ์—ฌ๊ธฐ์— ์ถ”๊ฐ€์ ์ธ ํŒŒ์ผ ์ฒ˜๋ฆฌ ๋กœ์ง์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค.
 
37
  text_list.append(text)
38
 
39
  # ์ฃผ์–ด์ง„ ํŒŒ์ผ ๋ชฉ๋ก์„ ๋ฐ˜๋ณตํ•˜๋ฉด์„œ ๊ฐ ํŒŒ์ผ์„ ์ฒ˜๋ฆฌ
40
+ for doc in docs:
41
+ if isinstance(doc, tuple) and len(doc) == 2:
42
+ filename, file_content = doc
43
+ if filename.lower().endswith('.txt'): # ํŒŒ์ผ ํ™•์žฅ์ž ํ™•์ธ
44
+ bytes_file = BytesIO(file_content.encode()) # BytesIO๋กœ ๋ณ€ํ™˜
45
+ process_txt_file(bytes_file.getvalue()) # .txt ํŒŒ์ผ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ ํ˜ธ์ถœ
46
 
47
  # ๋‹ค๋ฅธ ํŒŒ์ผ ์œ ํ˜•(PDF, CSV, JSON ๋“ฑ)์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ
48
  # ํ•„์š”ํ•˜๋‹ค๋ฉด ์—ฌ๊ธฐ์— ์ถ”๊ฐ€์ ์ธ ํŒŒ์ผ ์ฒ˜๋ฆฌ ๋กœ์ง์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค.