Commit
ยท
ad710b8
1
Parent(s):
acbcadf
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,20 @@ def get_pdf_text(pdf_docs):
|
|
30 |
# ํ
์คํธ ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์์
๋๋ค.
|
31 |
def get_text_file(docs):
|
32 |
text_list = []
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
37 |
text_list.append(text)
|
38 |
-
return text_list
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
|
42 |
|
|
|
30 |
# ํ
์คํธ ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์์
๋๋ค.
|
31 |
def get_text_file(docs):
|
32 |
text_list = []
|
33 |
+
|
34 |
+
# .txt ํ์ผ ์ฒ๋ฆฌ ๊ธฐ๋ฅ ์ถ๊ฐ
|
35 |
+
def process_txt_file(file):
|
36 |
+
if file.type == 'text/plain':
|
37 |
+
text = file.getvalue().decode("utf-8")
|
38 |
text_list.append(text)
|
|
|
39 |
|
40 |
+
for doc in docs:
|
41 |
+
process_txt_file(doc) # .txt ํ์ผ ์ฒ๋ฆฌ ํจ์ ํธ์ถ
|
42 |
+
|
43 |
+
# ๋ค๋ฅธ ํ์ผ ์ ํ(PDF, CSV, JSON ๋ฑ)์ ๋ํ ์ฒ๋ฆฌ
|
44 |
+
# ํ์ํ ๊ฒฝ์ฐ ์ฌ๊ธฐ์ ์ถ๊ฐ์ ์ธ ํ์ผ ์ฒ๋ฆฌ ๋ก์ง์ ๊ตฌํํฉ๋๋ค.
|
45 |
+
|
46 |
+
return text_list
|
47 |
|
48 |
|
49 |
|