Skip to content

A TTS that fits in your CPU (and pocket)

Python

Read configs and the web page as UTF-8 (#392)

manu-lmcb77ab856165
diff --git a/pocket_tts/main.py b/pocket_tts/main.py
index 2378428..93887b6 100644
--- a/pocket_tts/main.py
+++ b/pocket_tts/main.py
@@ -73,7 +73,7 @@ def _loaded_model() -> TTSModel:
async def root() -> str:
"""Serve the frontend."""
static_path = Path(__file__).parent / "static" / "index.html"
- content = static_path.read_text()
+ content = static_path.read_text(encoding="utf-8")
# Replace the placeholder with the actual default text prompt
origin = str(_loaded_model().origin)
print(origin)
diff --git a/pocket_tts/utils/config.py b/pocket_tts/utils/config.py
index e74efb6..94aebb0 100644
--- a/pocket_tts/utils/config.py
+++ b/pocket_tts/utils/config.py
@@ -170,7 +170,7 @@ def load_config(yaml_path: str | Path) -> Config:
)
raise FileNotFoundError(f"Config file not found: {yaml_path}. Did you make a typo?")
- with open(yaml_path, "r") as f:
+ with open(yaml_path, encoding="utf-8") as f:
config_dict = yaml.safe_load(f)
return Config(**config_dict)