Update app.py
Browse files
app.py
CHANGED
|
@@ -30,8 +30,16 @@ def get_text_file(docs):
|
|
| 30 |
def get_csv_file(docs):
|
| 31 |
pass
|
| 32 |
|
| 33 |
-
def get_json_file(
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
|
|
|
| 30 |
def get_csv_file(docs):
|
| 31 |
pass
|
| 32 |
|
| 33 |
+
def get_json_file(json_docs):
|
| 34 |
+
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
| 35 |
+
temp_filepath = os.path.join(temp_dir.name, json_docs.name) # μμ νμΌ κ²½λ‘λ₯Ό μμ±ν©λλ€.
|
| 36 |
+
with open(temp_filepath, "wb") as f:
|
| 37 |
+
f.write(json_docs.getvalue())
|
| 38 |
+
file_path=temp_filepath,
|
| 39 |
+
jq_schema='.messages[].content',
|
| 40 |
+
text_content=False)
|
| 41 |
+
json_doc = json_loader.load()
|
| 42 |
+
return json_doc
|
| 43 |
|
| 44 |
|
| 45 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|