Spaces:
Runtime error
Runtime error
JinHyeong99
commited on
Commit
·
ffe03b9
1
Parent(s):
3f951cd
app.py
CHANGED
@@ -51,9 +51,13 @@ def get_json_file(json_docs):
|
|
51 |
temp_dir = tempfile.TemporaryDirectory()
|
52 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
53 |
with open(temp_filepath, "wb") as f:
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
json_loader = JSONLoader(
|
56 |
-
file_path
|
57 |
jq_schema=None)
|
58 |
json_doc = json_loader.load()
|
59 |
return json_doc
|
|
|
51 |
temp_dir = tempfile.TemporaryDirectory()
|
52 |
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
53 |
with open(temp_filepath, "wb") as f:
|
54 |
+
# 파일에 쓰기 전에 데이터가 bytes 형식인지 확인
|
55 |
+
data_to_write = json_docs.getvalue()
|
56 |
+
if isinstance(data_to_write, str):
|
57 |
+
data_to_write = data_to_write.encode() # str을 bytes로 변환
|
58 |
+
f.write(data_to_write)
|
59 |
json_loader = JSONLoader(
|
60 |
+
file_path=temp_filepath,
|
61 |
jq_schema=None)
|
62 |
json_doc = json_loader.load()
|
63 |
return json_doc
|