Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ def get_text_file(text_docs):
|
|
| 38 |
|
| 39 |
def get_csv_file(csv_docs):
|
| 40 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 41 |
-
temp_filepath = os.path.join(temp_dir.name,
|
| 42 |
with open(temp_filepath, "wb") as f:
|
| 43 |
f.write(csv_docs.getvalue()) # CSV ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 44 |
csv_loader = CSVLoader(temp_filepath) # CSVLoader๋ฅผ ์ฌ์ฉํด CSV๋ฅผ ๋ก๋ํฉ๋๋ค.
|
|
@@ -47,7 +47,7 @@ def get_csv_file(csv_docs):
|
|
| 47 |
|
| 48 |
def get_json_file(json_docs):
|
| 49 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 50 |
-
temp_filepath = os.path.join(temp_dir.name,
|
| 51 |
with open(temp_filepath, "wb") as f:
|
| 52 |
f.write(json_docs.getvalue()) # JSON ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 53 |
json_loader = JSONLoader(temp_filepath, jq_schema='.messages[].content', text_content=False) # JSONLoader๋ฅผ ์ฌ์ฉํด JSON๋ฅผ ๋ก๋ํฉ๋๋ค.
|
|
|
|
| 38 |
|
| 39 |
def get_csv_file(csv_docs):
|
| 40 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 41 |
+
temp_filepath = os.path.join(temp_dir.name, "temp_file.csv") # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 42 |
with open(temp_filepath, "wb") as f:
|
| 43 |
f.write(csv_docs.getvalue()) # CSV ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 44 |
csv_loader = CSVLoader(temp_filepath) # CSVLoader๋ฅผ ์ฌ์ฉํด CSV๋ฅผ ๋ก๋ํฉ๋๋ค.
|
|
|
|
| 47 |
|
| 48 |
def get_json_file(json_docs):
|
| 49 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
| 50 |
+
temp_filepath = os.path.join(temp_dir.name,"temp_file.json") # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
| 51 |
with open(temp_filepath, "wb") as f:
|
| 52 |
f.write(json_docs.getvalue()) # JSON ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 53 |
json_loader = JSONLoader(temp_filepath, jq_schema='.messages[].content', text_content=False) # JSONLoader๋ฅผ ์ฌ์ฉํด JSON๋ฅผ ๋ก๋ํฉ๋๋ค.
|