Spaces:
Sleeping
Sleeping
commit_4
Browse files
app.py
CHANGED
@@ -50,7 +50,6 @@ def get_csv_file(docs):
|
|
50 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
51 |
return csv_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
52 |
|
53 |
-
|
54 |
def get_json_file(docs):
|
55 |
temp_dir = tempfile.TemporaryDirectory()
|
56 |
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
@@ -58,17 +57,15 @@ def get_json_file(docs):
|
|
58 |
f.write(docs.getvalue())
|
59 |
json_loader = JSONLoader(temp_filepath)
|
60 |
json_data = json_loader.load()
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
)
|
69 |
-
|
70 |
-
|
71 |
-
return json_doc
|
72 |
|
73 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
74 |
def get_text_chunks(documents):
|
|
|
50 |
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
51 |
return csv_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
52 |
|
|
|
53 |
def get_json_file(docs):
|
54 |
temp_dir = tempfile.TemporaryDirectory()
|
55 |
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
|
|
57 |
f.write(docs.getvalue())
|
58 |
json_loader = JSONLoader(temp_filepath)
|
59 |
json_data = json_loader.load()
|
60 |
+
# json_spec = JsonSpec(dict_=json_data, max_value_length=4000)
|
61 |
+
# json_toolkit = JsonToolkit(spec=json_spec)
|
62 |
+
# json_agent_executor = create_json_agent(
|
63 |
+
# llm=OpenAI(temperature=0),
|
64 |
+
# toolkit=json_toolkit,
|
65 |
+
# verbose=True
|
66 |
+
# )
|
67 |
+
# json_doc = json_agent_executor.execute(text=temp_filepath)
|
68 |
+
return json_data
|
|
|
|
|
69 |
|
70 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
71 |
def get_text_chunks(documents):
|