gorkemgoknar
commited on
Commit
•
63c2202
1
Parent(s):
60f92e9
limit to 10 characters for language detections as some may be common
Browse files
app.py
CHANGED
@@ -29,17 +29,19 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree):
|
|
29 |
#we use zh-cn
|
30 |
language_predicted = "zh-cn"
|
31 |
#This is for identifying problems only.
|
32 |
-
print(f"Detected language:{language_predicted}, Chosen language:{language}
|
33 |
|
34 |
-
if
|
35 |
-
#
|
36 |
-
|
37 |
-
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
|
45 |
|
|
|
29 |
#we use zh-cn
|
30 |
language_predicted = "zh-cn"
|
31 |
#This is for identifying problems only.
|
32 |
+
print(f"Detected language:{language_predicted}, Chosen language:{language}")
|
33 |
|
34 |
+
if len(prompt)>10:
|
35 |
+
#allow any language for short text as some may be common
|
36 |
+
if language_predicted != language:
|
37 |
+
#Please duplicate and remove this check if you really want this
|
38 |
+
#Or auto-detector fails to identify language (which it can on pretty short text or mixed text)
|
39 |
+
gr.Warning(f"Auto-Predicted Language in prompt (detected: {language_predicted}) does not match language you chose (chosen: {language}) , please choose correct language id. If you think this is incorrect please duplicate this space and modify code.")
|
40 |
|
41 |
+
return (
|
42 |
+
None,
|
43 |
+
None,
|
44 |
+
)
|
45 |
|
46 |
|
47 |
|