> How to make Voice Search Assistant | Python Voice search Assistant - TECH UPDATE

How to make Voice Search Assistant | Python Voice search Assistant


How  to make Voice Search Assistant Using Python Script 



For doing Voice search assistant using Python there are two library files you definitely downloaded

1) SpeechRecognition Library By using pip install SpeechRecognition command you download this library. 
2) Pyaudio Library By using pip install pyaudio command you download this library. 

Note: Sometimes it is very difficult to download this Pyaudio by using the above command so follow this.

1) Check your python version
2) Download the below whl file related to your python version for example in case of python 3.7 and using a 64-bit operating system your file is like that PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl. 
3) Open command prompt or anaconda prompt type below like that. (Remember the downloaded path). 


After installing pyaudio and SpeechRecognition use this python script


import speech_recognition as sr
import webbrowser
sr.Microphone(device_index=1)
r=sr.Recognizer()
r.energy_threshold=5000
with sr.Microphone() as source:
    print("Speak loudly ")
    audio=r.listen(source)
    try:
        text=r.recognize_google(audio)
        print("You said : {}".format(text))
        url='https://www.google.co.in/search?q='
        search_url=url+text
        webbrowser.open(search_url)
    except:
        print("Can't recognize")


After run first print Speak loudly then you can speak anything it will print on the screen and automatically search it on Google. (Why Google? you put the ajax of URL in a python script that's why it is searching in google you can put any ajax of the site then it will be searching on that like Yahoo etc).

How to make Voice Search Assistant | Python Voice search Assistant How  to make Voice Search Assistant | Python Voice search Assistant Reviewed by TECH UPDATE on October 06, 2019 Rating: 5

No comments:

Powered by Blogger.