Update app.py
Browse files
app.py
CHANGED
|
@@ -28,11 +28,11 @@ def get_pdf_text(pdf_docs):
|
|
| 28 |
# ๊ณผ์
|
| 29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 30 |
# txt ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 31 |
-
def get_text_file(
|
| 32 |
temp_dir = tempfile.TemporaryDirectory()
|
| 33 |
-
temp_filepath = os.path.join(temp_dir.name,
|
| 34 |
with open(temp_filepath, "wb") as f:
|
| 35 |
-
f.write(
|
| 36 |
text_loader = TextLoader(temp_filepath)
|
| 37 |
text_doc = text_loader.load()
|
| 38 |
return text_doc
|
|
|
|
| 28 |
# ๊ณผ์
|
| 29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 30 |
# txt ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 31 |
+
def get_text_file(text_docs):
|
| 32 |
temp_dir = tempfile.TemporaryDirectory()
|
| 33 |
+
temp_filepath = os.path.join(temp_dir.name, text_docs.name)
|
| 34 |
with open(temp_filepath, "wb") as f:
|
| 35 |
+
f.write(text_docs.getvalue())
|
| 36 |
text_loader = TextLoader(temp_filepath)
|
| 37 |
text_doc = text_loader.load()
|
| 38 |
return text_doc
|