Spaces:
Sleeping
Sleeping
commit_2
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def get_text_file(docs):
|
|
45 |
def get_csv_file(docs):
|
46 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
47 |
temp_filepath = os.path.join(temp_dir.name, docs.name) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
48 |
-
with open(temp_filepath, "
|
49 |
f.write(docs.getvalue()) # csv ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
50 |
csv_loader = CSVLoader(temp_filepath) # CSVLoader๋ฅผ ์ฌ์ฉํด csv์ ๋ก๋ํฉ๋๋ค.
|
51 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
@@ -55,9 +55,8 @@ def get_csv_file(docs):
|
|
55 |
def get_json_file(docs):
|
56 |
temp_dir = tempfile.TemporaryDirectory()
|
57 |
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
58 |
-
with open(temp_filepath, "
|
59 |
f.write(docs.getvalue())
|
60 |
-
|
61 |
json_loader = JSONLoader(temp_filepath)
|
62 |
json_data = json_loader.load()
|
63 |
|
|
|
45 |
def get_csv_file(docs):
|
46 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
47 |
temp_filepath = os.path.join(temp_dir.name, docs.name) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
48 |
+
with open(temp_filepath, "wb") as f: # ์์ ํ์ผ์ ํ
์คํธ ์ฐ๊ธฐ ๋ชจ๋๋ก ์ฝ๋๋ค.
|
49 |
f.write(docs.getvalue()) # csv ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
50 |
csv_loader = CSVLoader(temp_filepath) # CSVLoader๋ฅผ ์ฌ์ฉํด csv์ ๋ก๋ํฉ๋๋ค.
|
51 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
|
|
55 |
def get_json_file(docs):
|
56 |
temp_dir = tempfile.TemporaryDirectory()
|
57 |
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
58 |
+
with open(temp_filepath, "wb") as f:
|
59 |
f.write(docs.getvalue())
|
|
|
60 |
json_loader = JSONLoader(temp_filepath)
|
61 |
json_data = json_loader.load()
|
62 |
|