DDingcheol commited on
Commit
c2009a1
ยท
1 Parent(s): 96060c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -33,24 +33,24 @@ def get_text_file(docs):
33
 
34
  # .txt ํŒŒ์ผ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜
35
  def process_txt_file(file_content):
36
- text = file_content.decode("utf-8")
37
- text_list.append(text)
38
 
39
  # ์ฃผ์–ด์ง„ ํŒŒ์ผ ๋ชฉ๋ก์„ ๋ฐ˜๋ณตํ•˜๋ฉด์„œ ๊ฐ ํŒŒ์ผ์„ ์ฒ˜๋ฆฌ
40
- for file_content in docs:
41
  try:
42
- file_content.decode("utf-8") # ํŒŒ์ผ ๋‚ด์šฉ์ด ์œ ์š”ํ•œ์ง€ ํ™•์ธ
43
- process_txt_file(file_content) # .txt ํŒŒ์ผ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ ํ˜ธ์ถœ
44
- except Exception as e:
45
- pass # ํ…์ŠคํŠธ๊ฐ€ ์•„๋‹Œ ํŒŒ์ผ์€ ๊ฑด๋„ˆ๋œ๋‹ˆ๋‹ค.
46
-
47
- # ๋‹ค๋ฅธ ํŒŒ์ผ ์œ ํ˜•(PDF, CSV, JSON ๋“ฑ)์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ
48
- # ํ•„์š”ํ•˜๋‹ค๋ฉด ์—ฌ๊ธฐ์— ์ถ”๊ฐ€์ ์ธ ํŒŒ์ผ ์ฒ˜๋ฆฌ ๋กœ์ง์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค.
49
 
50
  return text_list
51
 
52
 
53
 
 
54
  def get_csv_file(docs):
55
  text_list = []
56
  for doc in docs:
 
33
 
34
  # .txt ํŒŒ์ผ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜
35
  def process_txt_file(file_content):
36
+ text_list.append(file_content)
 
37
 
38
  # ์ฃผ์–ด์ง„ ํŒŒ์ผ ๋ชฉ๋ก์„ ๋ฐ˜๋ณตํ•˜๋ฉด์„œ ๊ฐ ํŒŒ์ผ์„ ์ฒ˜๋ฆฌ
39
+ for file_data in docs:
40
  try:
41
+ # ํŒŒ์ผ ๋‚ด์šฉ์ด ํ…์ŠคํŠธ์ธ ๊ฒฝ์šฐ์—๋งŒ ํ…์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€
42
+ if isinstance(file_data, tuple) and len(file_data) == 2:
43
+ filename, file_content = file_data
44
+ if isinstance(file_content, str):
45
+ process_txt_file(file_content)
46
+ except IndexError:
47
+ pass # ํŠœํ”Œ ํ˜•์‹์ด ์•„๋‹Œ ๊ฒฝ์šฐ ๊ฑด๋„ˆ๋œ๋‹ˆ๋‹ค.
48
 
49
  return text_list
50
 
51
 
52
 
53
+
54
  def get_csv_file(docs):
55
  text_list = []
56
  for doc in docs: