Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions voxflow/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def _build_quick_controls(self):
text_color=C["txt3"]).pack(anchor="w")
self.lang_var = ctk.StringVar(value=self.config.language)
ctk.CTkOptionMenu(
lf, values=["auto", "pl", "en", "de", "fr", "es", "it", "uk"],
lf, values=["auto", "pl", "en", "de", "fr", "es", "it", "uk", "zh-yue"],
variable=self.lang_var,
font=ctk.CTkFont(size=11),
fg_color=C["bg_input"],
Expand Down Expand Up @@ -987,7 +987,7 @@ def _on_done(self, result: dict):
_LANG_FLAGS = {
"pl": "🇵🇱", "en": "🇬🇧", "de": "🇩🇪",
"fr": "🇫🇷", "es": "🇪🇸", "it": "🇮🇹",
"uk": "🇺🇦",
"uk": "🇺🇦", "zh-yue": "🇭🇰",
}
flag = _LANG_FLAGS.get(lang, "🌍")
dur = result.get("duration", 0)
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def _refresh_history(self):
_LANG_FLAGS = {
"pl": "🇵🇱", "en": "🇬🇧", "de": "🇩🇪",
"fr": "🇫🇷", "es": "🇪🇸", "it": "🇮🇹",
"uk": "🇺🇦",
"uk": "🇺🇦", "zh-yue": "🇭🇰",
}
flag = _LANG_FLAGS.get(e["language"], "🌍")
preview = e["text"][:44] + ("…" if len(e["text"]) > 44 else "")
Expand Down
5 changes: 3 additions & 2 deletions voxflow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_config_dir() -> Path:

# Valid value ranges for security validation
_VALID_MODELS = {"tiny", "base", "small", "medium", "large-v3"}
_VALID_LANGUAGES = {"auto", "pl", "en", "de", "fr", "es", "it", "uk"}
_VALID_LANGUAGES = {"auto", "pl", "en", "de", "fr", "es", "it", "uk", "zh-yue"}
# Hotkey validation: allow any non-empty string (hotkey picker can produce
# arbitrary key names). We only enforce it's a safe non-empty string.
_VALID_TYPING_METHODS = {"clipboard", "keyboard"}
Expand Down Expand Up @@ -100,7 +100,7 @@ class VoxFlowConfig:
"""Application configuration."""
# Model settings
model_size: str = "small"
language: str = "auto" # "auto", "pl", "en", "de", "fr", "es", "it", "uk"
language: str = "auto" # "auto", "pl", "en", "de", "fr", "es", "it", "uk", "zh-yue"
device: str = "cpu" # "cpu" or "cuda"
compute_type: str = "int8" # "int8" for CPU, "float16" for GPU

Expand Down Expand Up @@ -181,6 +181,7 @@ def available_languages(self) -> dict:
"es": "🇪🇸 Español",
"it": "🇮🇹 Italiano",
"uk": "🇺🇦 Українська",
"zh-yue": "🇭🇰 粵語 (Cantonese)",
}

@property
Expand Down
16 changes: 16 additions & 0 deletions voxflow/post_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"äh", "ähm", "hm", "öh", "öhm", "hmm", "ehm",
}

# Common Cantonese filler words/sounds that Whisper sometimes outputs
CANTONESE_FILLERS = {
"嗯", "啊", "呀", "吖", "喎", "嘅", "喇", "咧", "咯",
}

# Common German Whisper corrections
GERMAN_CORRECTIONS = {
# Common split compounds
Expand Down Expand Up @@ -107,6 +112,8 @@ def post_process(
result = _remove_fillers(result, POLISH_FILLERS)
if language == "de":
result = _remove_fillers(result, GERMAN_FILLERS)
if language == "zh-yue":
result = _remove_fillers(result, CANTONESE_FILLERS)

# 4. Apply language-specific corrections
if apply_corrections:
Expand Down Expand Up @@ -262,6 +269,13 @@ def _final_cleanup(text: str) -> str:
"Polski tekst zawiera poprawne znaki diakrytyczne: ą, ć, ę, ł, ń, ó, ś, ź, ż."
)

CANTONESE_INITIAL_PROMPT = (
"Transcription of a recording in Cantonese (粵語). "
"The text is in traditional Cantonese Chinese. "
"Use traditional Chinese characters (繁體中文). "
"Common Cantonese words: 係, 唔, 幾, 咁, 喎, 呀, 吖, 喎, 嘅, 喇, 咧, 咯, 噶."
)


def get_initial_prompt(language: str) -> str:
"""Get the initial prompt for Whisper based on language.
Expand All @@ -275,5 +289,7 @@ def get_initial_prompt(language: str) -> str:
return ENGLISH_INITIAL_PROMPT
elif language == "de":
return GERMAN_INITIAL_PROMPT
elif language == "zh-yue":
return CANTONESE_INITIAL_PROMPT
else:
return AUTO_INITIAL_PROMPT
2 changes: 1 addition & 1 deletion voxflow/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def transcribe(
_LANG_FLAGS = {
"pl": "🇵🇱", "en": "🇬🇧", "de": "🇩🇪",
"fr": "🇫🇷", "es": "🇪🇸", "it": "🇮🇹",
"uk": "🇺🇦",
"uk": "🇺🇦", "zh-yue": "🇭🇰",
}
flag = _LANG_FLAGS.get(info.language, "🌍")
prob = info.language_probability * 100
Expand Down