Skip to main content

DONT BUY ALEXA!!!... CREATE YOUR OWN USING PYTHON|PROJECT|PYCHARM|

 Any Alexa Lovers???... Then this project is for you, create your own alexa by using Python..

by using 3 simple packages we can create own voice assistant, Packages are...

1. pip speech recognition

2. pip text to speech recognition

3. pip PyAudio

IMPORTANT: IN SOME SYSTEMS PYAUDUIO, INSTALLATION PROBLEM OCCURS, IN THAT CASE, CHECK YOUR PYTHON VERSION, USE PYTHON 3.6 OR ABOVE.

You can search the things, playmusic, and you can ask the funny question to alexa using below code..

import speech_recognition as sr
import pyttsx3
import pywhatkit
import datetime
import wikipedia
import pyjokes

listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)


def talk(text):
    engine.say(text)
    engine.runAndWait()


def take_command():
    try:
        with sr.Microphone() as source:
            print('listening...')
            voice = listener.listen(source)
            command = listener.recognize_google(voice)
            command = command.lower()
            if 'alexa' in command:
                command = command.replace('alexa', '')
                print(command)
    except:
        pass
    return command


def run_alexa():
    command = take_command()
    print(command)
    if 'play' in command:
        song = command.replace('play', '')
        talk('playing ' + song)
        pywhatkit.playonyt(song)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        talk('Current time is ' + time)
    elif 'who the heck is' in command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 1)
        print(info)
        talk(info)
    elif 'date' in command:
        talk('sorry, I have a headache')
    elif 'are you single' in command:
        talk('I am in a relationship with wifi')
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    else:
        talk('Please say the command again.')


while True:
    run_alexa()

for demo check the link attached below 

DONT BUY ALEXA

Comments

Popular posts from this blog

Create Your Own Browser Using Python | Python Project | PyQt5

This post is about Create Your Own Browser Using Python | Python Project | PyQt5, how to create a basic browser, by using Python, it so simple and easy to create, sometime browser which you're using may get slow down, that time you can use this browser. You may use this as mini-project for UG Programmes.   For Video Tutorial     Subscribe the Blog For More Updates: ______________ SOURCE CODE ______________ import sys from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebEngineWidgets import * class MainWindow(QMainWindow):     def __init__(self):         super(MainWindow, self).__init__()         self.browser = QWebEngineView()         self.browser.setUrl(QUrl('http://google.com'))         self.setCentralWidget(self.browser)         self.showMaximized()   ...

How To Download Money Heist Sticker

 Are You Money Heist Fan?? Do you want Money Heist Sticker??.. Then Follow the instructions below to get your Sticker. No Apps Required. 1. Open Whatsapp 2. Open Your Whatsapp Chat, Click On Emoji Icon. 3. Click On Sticker Option. 4. Click on Plus Icon. To add a new Sticker. 5. Now Add Your Money Hesit Sticker. 6. Now Click And Download.....!!!!