DDingcheol commited on
Commit
64515bb
Β·
1 Parent(s): 9923ac4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -34,7 +34,8 @@ def get_text_file(docs):
34
  # .txt 파일 처리 ν•¨μˆ˜
35
  def process_txt_file(file):
36
  filename = file.name.lower() # 파일 이름을 μ†Œλ¬Έμžλ‘œ λ³€ν™˜ν•˜μ—¬ ν™•μž₯자λ₯Ό ν™•μΈν•©λ‹ˆλ‹€.
37
- if filename.endswith('.txt'):
 
38
  text = file.getvalue().decode("utf-8")
39
  text_list.append(text)
40
 
@@ -43,13 +44,11 @@ def get_text_file(docs):
43
  process_txt_file(doc) # .txt 파일 처리 ν•¨μˆ˜ 호좜
44
 
45
  # λ‹€λ₯Έ 파일 μœ ν˜•(PDF, CSV, JSON λ“±)에 λŒ€ν•œ 처리
46
- # λ§Œμ•½ ν•„μš”ν•˜λ‹€λ©΄ 여기에 좔가적인 파일 처리 λ‘œμ§μ„ κ΅¬ν˜„ν•©λ‹ˆλ‹€.
47
 
48
  return text_list
49
 
50
 
51
-
52
-
53
  def get_csv_file(docs):
54
  text_list = []
55
  for doc in docs:
 
34
  # .txt 파일 처리 ν•¨μˆ˜
35
  def process_txt_file(file):
36
  filename = file.name.lower() # 파일 이름을 μ†Œλ¬Έμžλ‘œ λ³€ν™˜ν•˜μ—¬ ν™•μž₯자λ₯Ό ν™•μΈν•©λ‹ˆλ‹€.
37
+ file_extension = filename.split('.')[-1] # 파일 μ΄λ¦„μ—μ„œ ν™•μž₯자 μΆ”μΆœ
38
+ if file_extension == 'txt': # μΆ”μΆœν•œ ν™•μž₯μžκ°€ 'txt'인지 확인
39
  text = file.getvalue().decode("utf-8")
40
  text_list.append(text)
41
 
 
44
  process_txt_file(doc) # .txt 파일 처리 ν•¨μˆ˜ 호좜
45
 
46
  # λ‹€λ₯Έ 파일 μœ ν˜•(PDF, CSV, JSON λ“±)에 λŒ€ν•œ 처리
47
+ # ν•„μš”ν•˜λ‹€λ©΄ 여기에 좔가적인 파일 처리 λ‘œμ§μ„ κ΅¬ν˜„ν•©λ‹ˆλ‹€.
48
 
49
  return text_list
50
 
51
 
 
 
52
  def get_csv_file(docs):
53
  text_list = []
54
  for doc in docs: