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