Delete app.py
Browse files
app.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
# Updated Mapping with specific model prefixes
|
| 2 |
-
LANGUAGE_MAP = {
|
| 3 |
-
"Hindi": {"model": "Helsinki-NLP/opus-mt-en-hi", "voice_code": "hi", "prefix": ""},
|
| 4 |
-
"Tamil": {"model": "Helsinki-NLP/opus-mt-en-dra", "voice_code": "ta", "prefix": ""},
|
| 5 |
-
"Telugu": {"model": "Helsinki-NLP/opus-mt-en-dra", "voice_code": "te", "prefix": ""},
|
| 6 |
-
"Gujarati": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "gu", "prefix": ">>guj<<"},
|
| 7 |
-
"Marathi": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "mr", "prefix": ">>mar<<"},
|
| 8 |
-
"Assamese": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "as", "prefix": ">>asm<<"}
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
# In your translate function, update the input text like this:
|
| 12 |
-
def translate_and_speak(text, target_lang):
|
| 13 |
-
config = LANGUAGE_MAP[target_lang]
|
| 14 |
-
# Add the prefix so the model knows the target language
|
| 15 |
-
prepared_text = config["prefix"] + text
|
| 16 |
-
# ... rest of your translation code using prepared_text ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|