Commit
ยท
009d12e
1
Parent(s):
a04e0a2
Update app.py
Browse files
app.py
CHANGED
@@ -32,15 +32,14 @@ def get_text_file(docs):
|
|
32 |
text_list = []
|
33 |
|
34 |
# .txt ํ์ผ ์ฒ๋ฆฌ ํจ์
|
35 |
-
def process_txt_file(
|
36 |
-
|
37 |
-
|
38 |
-
text = file_content.decode("utf-8")
|
39 |
-
text_list.append(text)
|
40 |
|
41 |
# ์ฃผ์ด์ง ํ์ผ ๋ชฉ๋ก์ ๋ฐ๋ณตํ๋ฉด์ ๊ฐ ํ์ผ์ ์ฒ๋ฆฌ
|
42 |
-
for
|
43 |
-
|
|
|
44 |
|
45 |
# ๋ค๋ฅธ ํ์ผ ์ ํ(PDF, CSV, JSON ๋ฑ)์ ๋ํ ์ฒ๋ฆฌ
|
46 |
# ํ์ํ๋ค๋ฉด ์ฌ๊ธฐ์ ์ถ๊ฐ์ ์ธ ํ์ผ ์ฒ๋ฆฌ ๋ก์ง์ ๊ตฌํํฉ๋๋ค.
|
@@ -49,6 +48,7 @@ def get_text_file(docs):
|
|
49 |
|
50 |
|
51 |
|
|
|
52 |
def get_csv_file(docs):
|
53 |
text_list = []
|
54 |
for doc in docs:
|
|
|
32 |
text_list = []
|
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 |
+
pdf_bytes = BytesIO(file_content)
|
42 |
+
process_txt_file(pdf_bytes.read()) # .txt ํ์ผ ์ฒ๋ฆฌ ํจ์ ํธ์ถ
|
43 |
|
44 |
# ๋ค๋ฅธ ํ์ผ ์ ํ(PDF, CSV, JSON ๋ฑ)์ ๋ํ ์ฒ๋ฆฌ
|
45 |
# ํ์ํ๋ค๋ฉด ์ฌ๊ธฐ์ ์ถ๊ฐ์ ์ธ ํ์ผ ์ฒ๋ฆฌ ๋ก์ง์ ๊ตฌํํฉ๋๋ค.
|
|
|
48 |
|
49 |
|
50 |
|
51 |
+
|
52 |
def get_csv_file(docs):
|
53 |
text_list = []
|
54 |
for doc in docs:
|