DDingcheol commited on
Commit
acbcadf
ยท
1 Parent(s): cc6f071

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -31,12 +31,15 @@ def get_pdf_text(pdf_docs):
31
  def get_text_file(docs):
32
  text_list = []
33
  for doc in docs:
34
- text = doc.getvalue().decode('utf-8') # 'BytesIO' ๊ฐ์ฒด์—์„œ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
35
- text_list.append(text)
 
 
36
  return text_list
37
 
38
 
39
 
 
40
  def get_csv_file(docs):
41
  text_list = []
42
  for doc in docs:
 
31
  def get_text_file(docs):
32
  text_list = []
33
  for doc in docs:
34
+ if doc.type == 'text/plain':
35
+ # ์—…๋กœ๋“œ๋œ .txt ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ฝ์–ด์˜ต๋‹ˆ๋‹ค
36
+ text = doc.getvalue().decode("utf-8") # UTF-8 ์ธ์ฝ”๋”ฉ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ฐ”์ดํŠธ๋ฅผ ๋ฌธ์ž์—ด๋กœ ๋””์ฝ”๋”ฉํ•ฉ๋‹ˆ๋‹ค
37
+ text_list.append(text)
38
  return text_list
39
 
40
 
41
 
42
+
43
  def get_csv_file(docs):
44
  text_list = []
45
  for doc in docs: