Spaces:
Runtime error
Runtime error
se0kcess
commited on
Commit
โข
93090c0
1
Parent(s):
8ccd0bd
"update get_text_file"
Browse files
app.py
CHANGED
@@ -24,12 +24,16 @@ def get_pdf_text(pdf_docs):
|
|
24 |
|
25 |
# ๊ณผ์
|
26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
|
|
|
|
|
|
27 |
def get_text_file(txt_docs):
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
# CSV ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
35 |
def get_csv_file(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 |
+
return txt_loader
|
37 |
|
38 |
# CSV ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
39 |
def get_csv_file(docs):
|