Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,11 @@ def get_csv_file(docs):
|
|
| 31 |
pass
|
| 32 |
|
| 33 |
def get_json_file(docs):
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
data = loader.load()
|
| 36 |
return data
|
| 37 |
|
|
|
|
| 31 |
pass
|
| 32 |
|
| 33 |
def get_json_file(docs):
|
| 34 |
+
temp_dir = tempfile.TemporaryDirectory()
|
| 35 |
+
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
| 36 |
+
with open(temp_filepath, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
| 37 |
+
f.write(docs.getvalue())
|
| 38 |
+
loader = JSONLoader(temp_filepath,'.messages[].content', text_content=False)
|
| 39 |
data = loader.load()
|
| 40 |
return data
|
| 41 |
|