Skip to content

feat: Add language selection to CLI and Gradio UI#15

Open
apolmig wants to merge 1 commit intoKugelaudio:mainfrom
apolmig:feat/language-selector
Open

feat: Add language selection to CLI and Gradio UI#15
apolmig wants to merge 1 commit intoKugelaudio:mainfrom
apolmig:feat/language-selector

Conversation

@apolmig
Copy link
Copy Markdown

@apolmig apolmig commented Feb 10, 2026

feat: Add language selection to CLI and Gradio UI

Closes #10

What

Adds explicit language selection across all interfaces — CLI flag, Gradio dropdown, and Python API param. Currently there's no way to tell the model which language you're targeting, so it relies on auto-detection which breaks on short texts and ambiguous input.

Changes

New: src/kugelaudio_open/languages.py

  • Language dataclass with ISO 639-1 code, name, flag, and quality tier (high/medium/limited based on YODAS2 coverage)
  • All 23 supported languages with structured metadata
  • Helpers for CLI validation, Gradio formatting, quality warnings
  • Display order prioritizes high-quality languages (en, de, fr, es first)

CLI (start.py)

python start.py generate "Hallo Welt!" -l de -o output.wav
python start.py generate "Bonjour!" --language fr -o output.wav
# Omitting -l preserves current auto-detect behavior

Gradio UI

  • Dropdown with flags and quality indicators (⚠️ for limited-tier languages)
  • Dynamic quality warning on language change

Tests: tests/test_languages.py

  • Data integrity, validation, roundtrip parsing, edge cases

Side effects

Also helps with:

Notes

  • Fully backward compatible — --language is optional everywhere
  • Quality tiers based on what the README already states about YODAS2 coverage
  • The language param needs to be wired into KugelAudioProcessor.__call__() — I've provided the integration patches but couldn't verify against the full model without GPU

Copilot AI review requested due to automatic review settings February 10, 2026 16:58
@apolmig
Copy link
Copy Markdown
Author

apolmig commented Feb 10, 2026

hi @kajode, pr submitted with help of opus4.6 extended, congrats on the awesome model

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds language metadata infrastructure for KugelAudio's 23 supported European languages, but does not include the CLI and Gradio UI integration promised in the PR title and description. The changes provide a foundation for explicit language selection to address auto-detection issues mentioned in issues #10, #9, and #2.

Changes:

  • New languages.py module with structured metadata for 23 languages, including ISO codes, names, flags, and quality tiers
  • Comprehensive test suite covering language data validation, lookup functions, and Gradio formatting helpers

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/kugelaudio_open/languages.py New module defining Language dataclass, metadata for 23 languages with quality tiers, and helper functions for validation and Gradio UI formatting
tests/test_languages.py Comprehensive test suite covering language data integrity, lookup functions, validation, quality warnings, and Gradio integration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""
Language configuration for KugelAudio Open.

Structured metadata for the 24 supported European languages with quality
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring claims "24 supported European languages" but the code actually defines 23 languages. This is inconsistent with the test file which correctly asserts 23 languages (test_languages.py line 13). The docstring should be updated to say "23 supported European languages" to match the actual implementation.

Suggested change
Structured metadata for the 24 supported European languages with quality
Structured metadata for the 23 supported European languages with quality

Copilot uses AI. Check for mistakes.
def parse_gradio_choice(choice: str) -> str:
"""Extract language code from Gradio dropdown value."""
try:
return choice.split("(")[-1].split(")")[0].strip()
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parse_gradio_choice function doesn't validate that the extracted code is a valid language. If a malformed input contains parentheses with an invalid code like "Test (zz)", it will return "zz" instead of falling back to DEFAULT_LANG. Consider validating the extracted code with get(code) and returning DEFAULT_LANG if it's None.

Suggested change
return choice.split("(")[-1].split(")")[0].strip()
# Ensure we are working with a string
if not isinstance(choice, str):
return DEFAULT_LANG
# Extract the text between the last '(' and the following ')'
code = choice.split("(")[-1].split(")")[0].strip()
# Validate the extracted code against known languages
if get(code) is not None:
return code
return DEFAULT_LANG

Copilot uses AI. Check for mistakes.
Comment thread tests/test_languages.py
Comment on lines +85 to +86
def test_parse_fallback(self):
assert parse_gradio_choice("garbage") == DEFAULT_LANG
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test_parse_fallback test only checks handling of completely malformed input ("garbage"), but doesn't test the case where input contains parentheses with an invalid language code like "Test (zz)". This edge case should be tested to ensure the function properly falls back to DEFAULT_LANG for invalid codes.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,107 @@
"""
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title and description claim to "Add language selection to CLI and Gradio UI" with examples showing CLI flags like -l de and --language fr, but no changes to start.py, cli.py, or the Gradio UI files are present in this diff. Only the language metadata module and tests are included. Either the PR description is inaccurate, or the integration code is missing from this pull request.

Copilot uses AI. Check for mistakes.
@apolmig apolmig force-pushed the feat/language-selector branch 2 times, most recently from e8cbf0b to 369c70e Compare February 10, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Choose language

2 participants