sudhanm commited on
Commit
2798eed
·
verified ·
1 Parent(s): 2911bf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -98,7 +98,7 @@ def transcribe(audio, language_choice):
98
  condition_on_previous_text=False
99
  )
100
 
101
- # If still wrong script, retry with stronger primer only
102
  if not is_script(strict_text, language_choice):
103
  strict_text = transcribe_once(
104
  audio_path=audio,
@@ -109,7 +109,11 @@ def transcribe(audio, language_choice):
109
  condition_on_previous_text=False
110
  )
111
 
112
- hk_translit = transliterate_to_hk(strict_text, language_choice)
 
 
 
 
113
 
114
  return strict_text, hk_translit
115
 
 
98
  condition_on_previous_text=False
99
  )
100
 
101
+ # Check script match — if wrong, retry without context, only strict primer
102
  if not is_script(strict_text, language_choice):
103
  strict_text = transcribe_once(
104
  audio_path=audio,
 
109
  condition_on_previous_text=False
110
  )
111
 
112
+ # Final check before transliteration
113
+ if is_script(strict_text, language_choice):
114
+ hk_translit = transliterate_to_hk(strict_text, language_choice)
115
+ else:
116
+ hk_translit = f"[Script mismatch: expected {language_choice}]"
117
 
118
  return strict_text, hk_translit
119