Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import wikipedia
- import speech_recognition as sr
- import datetime
- import time
- import os
- import requests
- import json
- import pyautogui
- import pyttsx3
- import webbrowser
- ai_name = 'Nebula'
- your_name = 'Nic'
- engine = pyttsx3.init('sapi5')
- voices = engine.getProperty('voices')
- for voice in voices:
- engine.getProperty('voices')
- engine.setProperty('voice', voices[1].id)
- rate = engine.setProperty('rate', 170)
- def speak(audio):
- engine.say(audio)
- engine.runAndWait()
- def greet_1():
- speak('Hello')
- speak(your_name)
- speak('My name is')
- speak(ai_name)
- def greeting():
- hour = int(datetime.datetime.now().hour)
- if hour >= 0 and hour<12:
- speak('Good Morning Commander')
- speak(your_name)
- elif hour>12 and hour<16:
- speak('Good Afternoon Commander')
- else:
- speak('Good Evening Commander')
- speak('How may I assist you?')
- def listening():
- # takes microphone input and converts it to text
- r = sr.Recognizer()
- with sr.Microphone() as source:
- print('Speak Now...')
- r.pause_threshold = 1
- audio = r.listen(source)
- try:
- print('Thinking...')
- query = r.recognize_google(audio, language='en-in')
- print('User said:\n')
- print(query)
- except Exception as e:
- print("Sorry I couldnt understand you.")
- return'None'
- return query
- if __name__ == "__main__":
- greeting()
- while True:
- query = listening().lower()
- if 'Boost' in query:
- speak('Applying Boost')
- pyautogui.press('tab')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement