I am trying to develop an python application to listen words and type, where it listens but when translate to a model it fails, is there any api limit? i used gemini api key.
import os
import speech_recognition as sr
from langchain_google_genai import ChatGoogleGenerativeAI
from gtts import gTTS
from playsound import playsound
translation = chat.generate_content(prompt=f"Translate this text to English: {text}“)
response_text = translation.result.candidates[0].content.parts[0].text
print(f"Translated text: {response_text}”)
Generate and play audio response
tts = gTTS(text=response_text, lang=lang)
tts.save("response.mp3")
playsound("response.mp3")