Spaces:
Sleeping
Sleeping
Commit
Β·
72eb9e9
1
Parent(s):
5475d7f
Update app.py
Browse files
app.py
CHANGED
@@ -50,12 +50,14 @@ 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.
|
54 |
-
|
|
|
55 |
json_doc = json_loader.load()
|
56 |
return json_doc
|
57 |
|
58 |
|
|
|
59 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
60 |
def get_text_chunks(documents):
|
61 |
text_splitter = RecursiveCharacterTextSplitter(
|
|
|
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.read()) # νμΌμ λ΄μ©μ μ°κΈ° μν΄ read()λ₯Ό μ¬μ©ν©λλ€.
|
54 |
+
|
55 |
+
json_loader = JSONLoader(file_path=temp_filepath)
|
56 |
json_doc = json_loader.load()
|
57 |
return json_doc
|
58 |
|
59 |
|
60 |
+
|
61 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
62 |
def get_text_chunks(documents):
|
63 |
text_splitter = RecursiveCharacterTextSplitter(
|