Commit
ยท
6edfa7e
1
Parent(s):
ff7260e
Update app.py
Browse files
app.py
CHANGED
@@ -37,10 +37,12 @@ def get_text_file(docs):
|
|
37 |
text_list.append(text)
|
38 |
|
39 |
# ์ฃผ์ด์ง ํ์ผ ๋ชฉ๋ก์ ๋ฐ๋ณตํ๋ฉด์ ๊ฐ ํ์ผ์ ์ฒ๋ฆฌ
|
40 |
-
for
|
41 |
-
if
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
|
45 |
# ๋ค๋ฅธ ํ์ผ ์ ํ(PDF, CSV, JSON ๋ฑ)์ ๋ํ ์ฒ๋ฆฌ
|
46 |
# ํ์ํ๋ค๋ฉด ์ฌ๊ธฐ์ ์ถ๊ฐ์ ์ธ ํ์ผ ์ฒ๋ฆฌ ๋ก์ง์ ๊ตฌํํฉ๋๋ค.
|
|
|
37 |
text_list.append(text)
|
38 |
|
39 |
# ์ฃผ์ด์ง ํ์ผ ๋ชฉ๋ก์ ๋ฐ๋ณตํ๋ฉด์ ๊ฐ ํ์ผ์ ์ฒ๋ฆฌ
|
40 |
+
for doc in docs:
|
41 |
+
if isinstance(doc, tuple) and len(doc) == 2:
|
42 |
+
filename, file_content = doc
|
43 |
+
if filename.lower().endswith('.txt'): # ํ์ผ ํ์ฅ์ ํ์ธ
|
44 |
+
bytes_file = BytesIO(file_content.encode()) # BytesIO๋ก ๋ณํ
|
45 |
+
process_txt_file(bytes_file.getvalue()) # .txt ํ์ผ ์ฒ๋ฆฌ ํจ์ ํธ์ถ
|
46 |
|
47 |
# ๋ค๋ฅธ ํ์ผ ์ ํ(PDF, CSV, JSON ๋ฑ)์ ๋ํ ์ฒ๋ฆฌ
|
48 |
# ํ์ํ๋ค๋ฉด ์ฌ๊ธฐ์ ์ถ๊ฐ์ ์ธ ํ์ผ ์ฒ๋ฆฌ ๋ก์ง์ ๊ตฌํํฉ๋๋ค.
|