Update app.py
Browse files
app.py
CHANGED
@@ -37,9 +37,19 @@ def get_csv_file(docs):
|
|
37 |
|
38 |
|
39 |
def get_json_file(docs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
jq_schema = {"key": "value"}
|
41 |
-
json_loader = JSONLoader(
|
42 |
json_doc = json_loader.load()
|
|
|
|
|
|
|
43 |
return json_doc
|
44 |
|
45 |
|
|
|
37 |
|
38 |
|
39 |
def get_json_file(docs):
|
40 |
+
# UploadedFile을 임시 파일로 저장
|
41 |
+
temp_dir = tempfile.TemporaryDirectory()
|
42 |
+
temp_filepath = os.path.join(temp_dir.name, "temp_file.json")
|
43 |
+
with open(temp_filepath, "wb") as f:
|
44 |
+
f.write(docs.getvalue())
|
45 |
+
|
46 |
+
# JSONLoader 초기화
|
47 |
jq_schema = {"key": "value"}
|
48 |
+
json_loader = JSONLoader(temp_filepath, jq_schema=jq_schema)
|
49 |
json_doc = json_loader.load()
|
50 |
+
|
51 |
+
temp_dir.cleanup()
|
52 |
+
|
53 |
return json_doc
|
54 |
|
55 |
|