Spaces:
Runtime error
Runtime error
JinHyeong99
commited on
Commit
ยท
c5d7e61
1
Parent(s):
0cbb204
app.py
CHANGED
@@ -34,13 +34,15 @@ def get_text_file(text_docs):
|
|
34 |
return text_doc
|
35 |
|
36 |
def get_csv_file(csv_docs):
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
|
45 |
def get_json_file(json_docs):
|
46 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
|
|
34 |
return text_doc
|
35 |
|
36 |
def get_csv_file(csv_docs):
|
37 |
+
def get_csv_file(csv_docs):
|
38 |
+
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|
39 |
+
temp_filepath = os.path.join(temp_dir.name, csv_docs.name) # ์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ์์ฑํฉ๋๋ค.
|
40 |
+
with open(temp_filepath, "wb") as f: # ์์ ํ์ผ์ ๋ฐ์ด๋๋ฆฌ ์ฐ๊ธฐ ๋ชจ๋๋ก ์ฝ๋๋ค.
|
41 |
+
f.write(csv_docs.getvalue()) # CSV ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
42 |
+
csv_loader = CSVLoader(temp_filepath) # CSVLoader ์ธ์คํด์ค๋ฅผ ์์ฑํฉ๋๋ค.
|
43 |
+
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
44 |
+
return csv_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
45 |
+
|
46 |
|
47 |
def get_json_file(json_docs):
|
48 |
temp_dir = tempfile.TemporaryDirectory() # ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
|