Delete app.py
Browse files12345678910111213141516# Updated Mapping with specific model prefixesLANGUAGE_MAP = { "Hindi": {"model": "Helsinki-NLP/opus-mt-en-hi", "voice_code": "hi", "prefix": ""}, "Tamil": {"model": "Helsinki-NLP/opus-mt-en-dra", "voice_code": "ta", "prefix": ""}, "Telugu": {"model": "Helsinki-NLP/opus-mt-en-dra", "voice_code": "te", "prefix": ""}, "Gujarati": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "gu", "prefix": ">>guj<<"}, "Marathi": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "mr", "prefix": ">>mar<<"}, "Assamese": {"model": "Helsinki-NLP/opus-mt-en-inc", "voice_code": "as", "prefix": ">>asm<<"}}
# In your translate function, update the input text like this:def translate_and_speak(text, target_lang): config = LANGUAGE_MAP[target_lang] # Add the prefix so the model knows the target language prepared_text = config["prefix"] + text # ... rest of your translation code using prepared_text ...app.pyDeleted-16