Skip to content

Commit

Permalink
fix error and improve library install process
Browse files Browse the repository at this point in the history
  • Loading branch information
y-chan committed Sep 11, 2023
1 parent 5afd1f6 commit 5a6cf74
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions voicevox_engine/downloadable_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def install_library(self, library_id: str, file: BytesIO):
temp_dir = TemporaryDirectory()
temp_dir_path = Path(temp_dir.name)
library_dir = self.library_root_dir / library_id
library_dir.mkdir(exist_ok=True)
# with open(library_dir / INFO_FILE, "w", encoding="utf-8") as f:
# json.dump(library_info, f, indent=4, ensure_ascii=False)
if not zipfile.is_zipfile(file):
Expand Down Expand Up @@ -241,7 +240,9 @@ def install_library(self, library_id: str, file: BytesIO):
models = list(
set(
map(
lambda p: str(p).split("/")[-2], temp_dir_path.glob("**/*.onnx")
# Windows向けにバックスラッシュの置き換え処理を入れる
lambda p: str(p).replace("\\", "/").split("/")[-2],
temp_dir_path.glob("**/*.onnx")
)
)
)
Expand All @@ -267,6 +268,8 @@ def install_library(self, library_id: str, file: BytesIO):
"models": models,
}
)

library_dir.mkdir(exist_ok=True)
with open(
library_dir / "library.json",
"w",
Expand Down

0 comments on commit 5a6cf74

Please sign in to comment.