Consulawtech commited on
Commit
751c735
·
1 Parent(s): 172f7f2

Nigerian language + English priced like the language alone; source revision bfdebd6

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -2123,12 +2123,14 @@ async def transcribe(
2123
  logger.info(f"Languages {lang_list} — CPU-only, staying with default model for speed")
2124
  effective_model = effective_model or _default_model_key()
2125
 
2126
- # One Nigerian language: use its dedicated model (falls back to large-v3
2127
- # inside the engine if it can't load).
2128
- if len(lang_list) == 1 and primary_lang in NATIVE_MODELS and native_asr_enabled() \
2129
- and NATIVE_MODELS[primary_lang] in engine.registry.list_available_models():
2130
- effective_model = NATIVE_MODELS[primary_lang]
2131
- logger.info(f"Language {primary_lang}: using {effective_model}")
 
 
2132
 
2133
  # Validate only; the worker switches models under _ENGINE_LOCK.
2134
  if effective_model and effective_model not in engine.registry.list_available_models():
 
2123
  logger.info(f"Languages {lang_list} — CPU-only, staying with default model for speed")
2124
  effective_model = effective_model or _default_model_key()
2125
 
2126
+ # One Nigerian language, alone or with English: use its dedicated model
2127
+ # (falls back to large-v3 inside the engine if it can't load), at the
2128
+ # same price either way.
2129
+ natives = [l for l in lang_list if l in NATIVE_MODELS]
2130
+ if len(natives) == 1 and all(l in NATIVE_MODELS or l == "en" for l in lang_list) and native_asr_enabled() \
2131
+ and NATIVE_MODELS[natives[0]] in engine.registry.list_available_models():
2132
+ effective_model = NATIVE_MODELS[natives[0]]
2133
+ logger.info(f"Languages {lang_list}: using {effective_model}")
2134
 
2135
  # Validate only; the worker switches models under _ENGINE_LOCK.
2136
  if effective_model and effective_model not in engine.registry.list_available_models():