Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,17 +47,20 @@ def get_csv_file(csv_docs):
|
|
47 |
csv_doc = csv_loader.load()
|
48 |
return csv_doc
|
49 |
|
|
|
50 |
def get_json_file(json_docs):
|
51 |
temp_dir = tempfile.TemporaryDirectory()
|
52 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
53 |
with open(temp_filepath, "wb") as f:
|
54 |
f.write(json_docs.getvalue())
|
55 |
-
|
|
|
|
|
|
|
56 |
json_doc = json_loader.load()
|
57 |
return json_doc
|
58 |
|
59 |
|
60 |
-
|
61 |
# 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.
|
62 |
def get_text_chunks(documents):
|
63 |
text_splitter = RecursiveCharacterTextSplitter(
|
|
|
47 |
csv_doc = csv_loader.load()
|
48 |
return csv_doc
|
49 |
|
50 |
+
|
51 |
def get_json_file(json_docs):
|
52 |
temp_dir = tempfile.TemporaryDirectory()
|
53 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
54 |
with open(temp_filepath, "wb") as f:
|
55 |
f.write(json_docs.getvalue())
|
56 |
+
|
57 |
+
# JSONLoader 초기화 시 jq_schema 지정
|
58 |
+
jq_schema = {} # JSONQuery 스키마, 필요에 따라 적절한 스키마를 지정해야 합니다.
|
59 |
+
json_loader = JSONLoader(temp_filepath, jq_schema=jq_schema)
|
60 |
json_doc = json_loader.load()
|
61 |
return json_doc
|
62 |
|
63 |
|
|
|
64 |
# 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.
|
65 |
def get_text_chunks(documents):
|
66 |
text_splitter = RecursiveCharacterTextSplitter(
|