Example #1
0
def predict():
    img=cv2.imread("/home/anmol/Desktop/test/t.jpg")
    face, rect = detect_face(img)
    label,s= face_recognizer.predict(face)
    print("welcome",name)
    veronica_notify("welcome" + name)
    speak("welcome " + name)
    exit()
Example #2
0
def train():
    speak("training")
    veronica_notify("Training")
    cam=cv2.VideoCapture(0)
    #time.sleep(10)
    for i in range(20):
        r,img=cam.read()
        cv2.imwrite("/home/anmol/Desktop/s2/"+str(i)+".jpg",img)
        time.sleep(1)
    del(cam)
Example #3
0
def search_wiki(keyword=''):
    print('V.E.R.O.N.I.C.A :Trying Wikipedia')
    #running the query
    searchResults = wikipedia.search(keyword)
    #if no result,print no result
    if not searchResults:
        print("NO results found")
        return
    #Search for page... try block
    try:
        page = wikipedia.page(searchResults[0])
    except wikipedia.DisambiguationError as err:
        #selecting first item in list
        page = wikipedia.page(err.option[0])
    #encoding the response to utf-8
    wikiTitle = str(page.title.encode('utf-8'))
    wikiSummary = str(page.summary.encode('utf-8'))
    #printing result
    print(wikiSummary)
    speak('Here is your result')
    veronica_notify(wikiSummary)
Example #4
0
def youtube_mp3(usr):
	chdir(MP3_DIR)
	try:		
		query_string=urllib.parse.urlencode({"search_query" : usr})
		html_content=urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
		search_results=re.findall(r'href=\"\/watch\?v=(.{11})',html_content.read().decode())
		url_result="http://www.youtube.com/watch?v=" + search_results[0] 
		print("result of search",url_result)
		#webbrowser.open_new_tab("http://www.youtube.com/watch?v=" + search_results[0])
		ydl_opts = {
		    'format': 'bestaudio/best',
		    'postprocessors': [{
		        'key': 'FFmpegExtractAudio',
		        'preferredcodec': 'mp3',
		        'preferredquality': '192',
		    }],
		}
		AudioIO.speak(usr + 'starting')
		veronica_notify(usr + ' starting')
		with youtube_dl.YoutubeDL(ydl_opts) as ydl:
		    ydl.download([url_result])
		AudioIO.speak(usr + 'complete')    
		veronica_notify(usr + ' complete')    
	except:
		AudioIO.speak('Could not download audio try later')
		veronica_notify('Could not download audio try later')	    
Example #5
0
def s_mail(mail_S, mail_R, mail_Sub, mail_M):

    print('inside func')

    # mail_ID=input("V.E.R.O.N.I.C.A: Enter Mail Id:")
    # mail_P=input("V.E.R.O.N.I.C.A: Enter Password:"******"V.E.R.O.N.I.C.A:Enter Your Mail:")
    # mail_R=input("V.E.R.O.N.I.C.A:Enter Recipents Email:")
    mail_settings = {
        "MAIL_SERVER": 'smtp.gmail.com',
        "MAIL_PORT": 465,
        "MAIL_USE_TLS": False,
        "MAIL_USE_SSL": True,
        "MAIL_USERNAME": mail_S,
        "MAIL_PASSWORD": '******'
    }

    app.config.update(mail_settings)
    mail = Mail(app)
    print('settings done')

    #if __name__ == '__main__':
    with app.app_context():
        msg = Message(
            subject=mail_Sub,
            sender=app.config.get("MAIL_USERNAME"),
            recipients=[mail_R],  # replace with your email for testing
            body=mail_M)
        speak('sending mail')
        veronica_notify('Sending Mail')
        mail.send(msg)
        speak("Mail Send")
        veronica_notify("Mail Send")


#s_mail()
Example #6
0
def youtube_mp4(usr):
    try:
        chdir(MP4_DIR)
        query_string = urllib.parse.urlencode({"search_query": usr})
        html_content = urllib.request.urlopen(
            "http://www.youtube.com/results?" + query_string)
        search_results = re.findall(r'href=\"\/watch\?v=(.{11})',
                                    html_content.read().decode())
        url_result = "http://www.youtube.com/watch?v=" + search_results[0]
        print("result of search", url_result)
        #webbrowser.open_new_tab("http://www.youtube.com/watch?v=" + search_results[0])
        ydl_opts = {}
        AudioIO.speak(usr + 'starting')
        veronica_notify(usr + ' starting')
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
            ydl.download([url_result])
        AudioIO.speak(usr + 'completed')
        veronica_notify(usr + ' completed')
    except:
        AudioIO.speak('Could not download video try again later')
        veronica_notify('Could not download video try again later')
Example #7
0
def fb():
    webbrowser.open_new_tab("http://www.facebook.com")
    veronica_notify("There You GO!!")
    text.insert(END,"Veronica:There You Go!!\n")
    speak("There You Go!!")
Example #8
0
def whatcanido():
    text.insert(END,"\nVERONICA:\nThere lots of think i can help you with...\n\n1)Daily news\n2)Browse websites\n3)Download Audio\n4)Download video\nand many more...\nJust tap the microphone\nOr type the text")
    veronica_notify("There lots of think i can help you with...\n\n1)Daily news\n2)Browse websites\n3)Download Audio\n4)Download video\nand many more...\nJust tap the microphone or type the text")
    speak("There lots of think i can help you with,Just tap the microphone or type the text")
Example #9
0
def insta():
    webbrowser.open_new_tab("http://www.instagram.com")
    veronica_notify("Veronica:There You GO!!")
    text.insert(END,"There You Go!!\n")
    speak("There You Go!!")
Example #10
0
login()


try:
    animation=pyglet.image.load_animation(LOGO_PATH)
    animSprite=pyglet.sprite.Sprite(animation)

    w=animSprite.width
    h=animSprite.height


    window=pyglet.window.Window(width=w,height=h)

    r,g,b,alpha=0.5,0.5,0.8,0.5

    pyglet.gl.glClearColor(r,g,b,alpha)
    pyglet.clock.schedule_once(pyglet.app.exit(),8)
    @window.event
    def on_draw():
        window.clear()
        animSprite.draw()
    pyglet.app.run()
except:
    window.close()
    speak("Hello sir,here is some daily info for you")
    veronica_notify("Hello sir,here is some daily info for you")
    text.insert(END,"Veronica:Hello Sir,here is some daily info for you\n")
    root.mainloop()  


Example #11
0
def main(text):

    update_log(text)

    if text in ["who are you", "introduce yourself"]:
        intro = 'I am Veronica, your personal assistant.'
        speak(intro)
        veronica_notify(intro)
        return

    elif "describe yourself" in text:
        intro = "I am Veronica, your personal assistant. I use python's speech recognition module to understand voice input, and google's text to speech technology to give output."
        speak(intro)
        veronica_notify(intro)

        return

    elif "toss a coin" in text:
        coin = random.randint(1, 2)
        if coin == 1:
            reply = "It is Tails"
            speak('It is tails')
            veronica_notify('It is tails')
        elif coin == 2:
            speak('It is heads')
            veronica_notify('It is heads')
            reply = 'It is heads'
        return reply

    elif text in ["throw a dice", "throw a die"]:
        dice = str(random.randint(1, 6))
        speak(dice)
        veronica_notify(dice)
        return

    elif text == "connection problem":
        speak('connection problem exiting')
        veronica_notify('connection problem exiting...')
        exit()

    elif text in ['stop', 'pause']:
        speak('Suspending')
        veronica_notify('Suspending')
        return 'pause'

    elif text in ["didn't get you", "terminate", 'bye', 'bye bye']:
        if text == "terminate":
            veronica_notify('Virtual Assistant Exited')
            speak("Bye Bye")
            exit(1)
        else:
            speak(text)
            # continue
    '''
    elif text in ["stop", "go to sleep"]:
        speak('Okay sir')
        stop = StopApp()
        stop.mainloop()
        continue
    '''

    #speak('fetching results please wait')

    if 'folder' in text or 'directory' in text:  #match(r'^.*(folder)|(directory) .*$', text):
        speak(nautilus.gen_folder_path(text))

    elif 'drive' in text:  #search(r'drive', text):
        speak(nautilus.gen_drive_path(text))

    elif 'meaning' in text or 'define' in text:  #search(r'(meaning)|(define)', text):
        speak(getMeaning(text))
        veronica_notify(getMeaning(text))

    elif 'run' in text or 'execute' in text:  #search(r'(run)|(execute)', text):
        speak(nautilus.open_gnome(text))
        veronica_notify(text)

    elif 'browse' in text:  #search(r'(browse)', text):
        speak(get_address(text))

    elif 'google' in text or 'search' in text:  # search(r'(google)|(search)', text):
        speak(get_result(text))
        veronica_notify('There you go !')

    elif 'download audio' in text:
        youtube_mp3(text)
        reply = 'Downloaded audio complete'
        return reply

    elif 'download video' in text:
        youtube_mp4(text)
        reply = 'Downloaded video complete' + text
        return reply

    elif 'youtube' in text:  #search(r'download\s(video)|(mp4)', text):
        speak('starting youtube')
        veronica_notify('starting youtube')
        reply = 'Starting Youtube'
        url_Open(text)
        return reply
        #speak(youtube_link(text[text.find('youtube results of')+len('youtube results of')+1:]))

    elif 'download lyrics' in text:  #search(r'download\s(lyrics)', text):
        speak(lyrics_down(text))

    elif 'temperature' in text or 'wolfram' in text or 'wikipedia' in text:
        temp = search(text)
        speak(temp)
        veronica_notify(temp)

    elif 'train' in text:
        train_veronica()

    elif 'vlc' in text or 'terminal' in text or 'python' in text or 'lock' in text or 'reboot' in text or 'saavn' in text or 'shutdown' in text or 'system monitor' in text:
        nautilus.open_gnome(text)
        return 'there you go'

    elif 'navigate' in text or 'place' in text or 'locate' in text:
        fetched = fetch(text)
        mapopen(fetched)
        return 'opening maps'

    elif 'nearby' in text or 'find some' in text or 'shop' in text:
        mapopen(text)
        return 'I have found some info for you'
    else:
        # #chat(text)
        # resp=bot.get_response("hello")
        # veronica_notify(resp)
        # speak(resp)
        #are you satisfied if not redirect to google
        speak(get_result_google(text))
        veronica_notify('There you go !')
    '''else: