Spaces:
Sleeping
Sleeping
Commit
Β·
3bd7aa1
1
Parent(s):
ef9ba64
Update app.py
Browse files
app.py
CHANGED
@@ -49,14 +49,13 @@ def get_csv_file(csv_docs):
|
|
49 |
def get_json_file(json_docs):
|
50 |
temp_dir = tempfile.TemporaryDirectory()
|
51 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
52 |
-
with open(temp_filepath, "wb") as f:
|
53 |
-
f.write(json_docs.getvalue())
|
54 |
-
json_loader = JSONLoader(file_path=temp_filepath)
|
55 |
json_doc = json_loader.load()
|
56 |
return json_doc
|
57 |
|
58 |
|
59 |
-
|
60 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
61 |
def get_text_chunks(documents):
|
62 |
text_splitter = RecursiveCharacterTextSplitter(
|
|
|
49 |
def get_json_file(json_docs):
|
50 |
temp_dir = tempfile.TemporaryDirectory()
|
51 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
52 |
+
with open(temp_filepath, "wb") as f:
|
53 |
+
f.write(json_docs.getvalue())
|
54 |
+
json_loader = JSONLoader(file_path=temp_filepath, jq_schema='.messages[].content', text_content=False)
|
55 |
json_doc = json_loader.load()
|
56 |
return json_doc
|
57 |
|
58 |
|
|
|
59 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
60 |
def get_text_chunks(documents):
|
61 |
text_splitter = RecursiveCharacterTextSplitter(
|