Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def get_pdf_text(pdf_docs):
|
|
| 24 |
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 27 |
-
def get_text_file(
|
| 28 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 29 |
temp_filepath = os.path.join(temp_dir.name, temp_file.txt) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 30 |
with open(temp_filepath, "wb") as f:
|
|
@@ -33,7 +33,7 @@ def get_text_file(docs):
|
|
| 33 |
text_doc = text_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 34 |
return text_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 35 |
|
| 36 |
-
def get_csv_file(
|
| 37 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 38 |
temp_filepath = os.path.join(temp_dir.name, temp_file.csv) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 39 |
with open(temp_filepath, "wb") as f:
|
|
@@ -42,7 +42,7 @@ def get_csv_file(docs):
|
|
| 42 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 43 |
return csv_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 44 |
|
| 45 |
-
def get_json_file(
|
| 46 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 47 |
temp_filepath = os.path.join(temp_dir.name, temp_file.json) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 48 |
with open(temp_filepath, "wb") as f:
|
|
|
|
| 24 |
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 27 |
+
def get_text_file(text_docs):
|
| 28 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 29 |
temp_filepath = os.path.join(temp_dir.name, temp_file.txt) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 30 |
with open(temp_filepath, "wb") as f:
|
|
|
|
| 33 |
text_doc = text_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 34 |
return text_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 35 |
|
| 36 |
+
def get_csv_file(csv_docs):
|
| 37 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 38 |
temp_filepath = os.path.join(temp_dir.name, temp_file.csv) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 39 |
with open(temp_filepath, "wb") as f:
|
|
|
|
| 42 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 43 |
return csv_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 44 |
|
| 45 |
+
def get_json_file(json_docs):
|
| 46 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 47 |
temp_filepath = os.path.join(temp_dir.name, temp_file.json) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 48 |
with open(temp_filepath, "wb") as f:
|