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: