Spaces:
Runtime error
Runtime error
se0kcess
commited on
Commit
ยท
950d69e
1
Parent(s):
93090c0
"update"
Browse files
app.py
CHANGED
|
@@ -24,16 +24,17 @@ def get_pdf_text(pdf_docs):
|
|
| 24 |
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 27 |
-
import os
|
| 28 |
-
import tempfile
|
| 29 |
-
|
| 30 |
def get_text_file(txt_docs):
|
| 31 |
temp_dir = tempfile.TemporaryDirectory()
|
| 32 |
temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
|
|
|
|
| 33 |
with open(temp_filepath, "w", encoding="utf-8") as f:
|
| 34 |
f.write(txt_docs.getvalue())
|
|
|
|
| 35 |
txt_loader = TextLoader(temp_filepath)
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# CSV ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 39 |
def get_csv_file(docs):
|
|
|
|
| 24 |
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
|
|
|
|
|
|
|
|
|
| 27 |
def get_text_file(txt_docs):
|
| 28 |
temp_dir = tempfile.TemporaryDirectory()
|
| 29 |
temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
|
| 30 |
+
|
| 31 |
with open(temp_filepath, "w", encoding="utf-8") as f:
|
| 32 |
f.write(txt_docs.getvalue())
|
| 33 |
+
|
| 34 |
txt_loader = TextLoader(temp_filepath)
|
| 35 |
+
txt_doc = txt_loader.load()
|
| 36 |
+
|
| 37 |
+
return txt_doc
|
| 38 |
|
| 39 |
# CSV ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 40 |
def get_csv_file(docs):
|