Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -98,7 +98,7 @@ def transcribe(audio, language_choice):
|
|
98 |
condition_on_previous_text=False
|
99 |
)
|
100 |
|
101 |
-
#
|
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 |
-
|
|
|
|
|
|
|
|
|
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 |
|