Speech to text function slower in Windows and the same function is slower in ubuntu

30 Views Asked by At

I have this function for speech to text in one of my gen ai projects which works fine in windows(My PC)but takes too long to work on ubuntu(jetson orin).

   `def live_speech_to_text(self):
        recognizer = sr.Recognizer()
        with sr.Microphone() as source:
            print("Listening...")
            recognizer.adjust_for_ambient_noise(source)
            audio = recognizer.listen(source)

        try:
            print("Recognizing...")
            text = recognizer.recognize_google(audio)
            return text
        except sr.UnknownValueError:
            print("Could not understand audio")
        except sr.RequestError as e:
            print("Could not request results from Google Web Speech API; {0}".format(e))`

It gets stuck after printing Recognizing... for about 2-3 mins which doesn't happen in my Windows low spec PC or any other Windows devices . What could be the possible reasons and solutions.

I tried using other models like pocketsphinx and vosx but they weren't accurate at all but were fast enough to give results , looking for a faster alternative with good accuracy ,atleast close to google in English language only , not looking for expertise in any other languages.

0

There are 0 best solutions below