samedi 28 novembre 2020

Speech Recognition program is not giving me proper output in python [ IDE:PyCharm ]

MY CODE :

import webbrowser as wb
import speech_recognition as sr

r = sr.Recognizer()
with sr.Microphone() as source:
    print("speak now")
    audio = r.listen(source)
    text = r.recognize_google(audio)
    try:
        if "youtube" in text:
           wb.open_new("www.youtube.com")
    except sr.UnknownValueError:
        print("error")
    except sr.RequestError as e:
        print("failed".format(e))

MY OUTPUT : speak now

Process finished with exit code 0

My code isn't opening web browser at all . can anyone fix it?




Aucun commentaire:

Enregistrer un commentaire