DDingcheol commited on
Commit
7368387
ยท
1 Parent(s): f7e4221

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -26,13 +26,14 @@ def get_pdf_text(pdf_docs):
26
  # ๊ณผ์ œ
27
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
28
  def get_text_file(docs):
29
- # ํ…์ŠคํŠธ ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ฝ์–ด์™€ ๋ฆฌ์ŠคํŠธ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
30
  text_list = []
31
- for doc in docs:
32
- content = doc.getvalue().decode("utf-8") # ํŒŒ์ผ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์™€์„œ UTF-8๋กœ ๋””์ฝ”๋”ฉํ•˜์—ฌ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜
33
- text_list.append(content) # ํ…์ŠคํŠธ๋ฅผ ๋ฆฌ์ŠคํŠธ์— ์ถ”๊ฐ€
34
-
35
- return text_list # ์ถ”์ถœ๋œ ํ…์ŠคํŠธ ๋ฆฌ์ŠคํŠธ ๋ฐ˜ํ™˜
 
 
36
 
37
 
38
  def get_csv_file(docs):
 
26
  # ๊ณผ์ œ
27
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
28
  def get_text_file(docs):
 
29
  text_list = []
30
+ for file in docs:
31
+ if file.type == 'text/plain':
32
+ # ํŒŒ์ผ์ด .txt์ธ ๊ฒฝ์šฐ
33
+ text = extract_text_from_file(file)
34
+ if text:
35
+ text_list.append(text)
36
+ return text_list
37
 
38
 
39
  def get_csv_file(docs):