Spaces:
Build error
Build error
๊น์์ค commited on
Commit ยท
dfaa737
1
Parent(s): 836b507
modify segmentation
Browse files
app.py
CHANGED
|
@@ -51,8 +51,9 @@ def get_json_file(json_docs):
|
|
| 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()) # json ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 54 |
-
json_loader = JSONLoader(temp_filepath) # Loader๋ฅผ ์ฌ์ฉํด json๋ฅผ ๋ก๋ํฉ๋๋ค.
|
| 55 |
-
|
|
|
|
| 56 |
return json_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 57 |
|
| 58 |
|
|
|
|
| 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()) # json ๋ฌธ์์ ๋ด์ฉ์ ์์ ํ์ผ์ ์๋๋ค.
|
| 54 |
+
json_loader = JSONLoader(temp_filepath, jq_schema='.', content_key='sender_name') # Loader๋ฅผ ์ฌ์ฉํด json๋ฅผ ๋ก๋ํฉ๋๋ค.
|
| 55 |
+
from pathlib import Path
|
| 56 |
+
json_doc = json_loader.loads((Path(temp_filepath).read_text())) # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 57 |
return json_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 58 |
|
| 59 |
|