Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def get_json_file(json_docs):
|
|
| 51 |
temp_filepath4 = os.path.join(temp_dir4.name, json_docs.name) # 임시 파일 경로를 생성합니다.
|
| 52 |
with open(temp_filepath4, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
| 53 |
f.write(json_docs.getvalue()) # json 문서의 내용을 임시 파일에 씁니다.
|
| 54 |
-
json_loader = JSONLoader(temp_filepath4
|
| 55 |
json_doc = json_loader.load() # 텍스트를 추출합니다.
|
| 56 |
return json_doc # 추출한 텍스트를 반환합니다.
|
| 57 |
|
|
@@ -65,8 +65,6 @@ def get_text_chunks(documents):
|
|
| 65 |
)
|
| 66 |
|
| 67 |
documents = text_splitter.split_documents(documents) # 문서들을 청크로 나눕니다
|
| 68 |
-
if not documents:
|
| 69 |
-
raise ValueError("업로드된 문서가 없거나 모든 문서가 비어 있습니다.")
|
| 70 |
return documents # 나눈 청크를 반환합니다.
|
| 71 |
|
| 72 |
|
|
|
|
| 51 |
temp_filepath4 = os.path.join(temp_dir4.name, json_docs.name) # 임시 파일 경로를 생성합니다.
|
| 52 |
with open(temp_filepath4, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
| 53 |
f.write(json_docs.getvalue()) # json 문서의 내용을 임시 파일에 씁니다.
|
| 54 |
+
json_loader = JSONLoader(temp_filepath4) # JSONLoader를 사용해 json를 로드합니다.
|
| 55 |
json_doc = json_loader.load() # 텍스트를 추출합니다.
|
| 56 |
return json_doc # 추출한 텍스트를 반환합니다.
|
| 57 |
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
documents = text_splitter.split_documents(documents) # 문서들을 청크로 나눕니다
|
|
|
|
|
|
|
| 68 |
return documents # 나눈 청크를 반환합니다.
|
| 69 |
|
| 70 |
|