def speak(entry):
    
    '''Objective-To define a function speak which prompts user to input by voice
       Input- Entry widget of main window of assistant
       Result-Entry widget will be filled by the voice input by user
    '''    
    
    speech.speak("Input by your voice", "en")
    
    #SpeechRec initialize
    
    #Using Recogonizer class for recognizing input coice
    #Using Microphone class to recogonize input voice via device's microphone
    
    r=sr.Recognizer()
    mic=sr.Microphone()
    
    with mic as source:
        r.adjust_for_ambient_noise(source)
        audio=r.listen(source)


    getvoice= r.recognize_google(audio)
    print(getvoice)
    
    #Insert Voice input in Entry Widget of master window first by clearing filled text in the widget
    #Using delete function and Insert function
    
    entry.delete(0,tk.END)
    entry.insert(0,getvoice)
def tell_joke():
    jokes = [
        'What happens to a frogs car when it breaks down? It gets toad away.',
        'Why was six scared of seven? Because seven ate nine.',
        'No, I always forget the punch line.'
    ]
    speak(random.choice(jokes))
def ass_speak(answer):
    
    '''Objective-To define a function ass_speak to speak a specific text
       Input-String answer which will be output as voice
    '''
    
    speech.speak(answer,"en")
def movie_greeting(name):
    """The greeting to the movie theater
    """
    text = "Hello! Welcome to the Lehigh Valley Movie Theater. "
    text += "You can go to the box office and get your ticket "
    text += "or you can go to the concessions for some snacks. "
    text += "Where would you like to go %s?" % name
    text = wrap_text(text, "GoodNews")
    speak(text)
Exemple #5
0
def weather():
    owm = pyowm.OWM('c52482b8b220cf92f2efffb459b2e6b3')
    observation = owm.weather_at_place('Pokhara, NP')
    weather = observation.get_weather()
    temperature = weather.get_temperature('celsius')['temp']
    wind = weather.get_wind('miles_hour')["speed"]
    status = weather.get_detailed_status()
    speak("The temperature in Pokhara is:" + str(temperature) +
          "degree celsius." + ",Wind is travelling with speed:" + str(wind) +
          "miles per hour." + ",The weather status today is" + status)
def parking_lot():
    text = "You've reached the parking lot. "
    if random.random() < 0.25:
        text += "Oh no! Some monkeys escaped. "
        text += "They have gotten into your car! "
        # runGif("ZooGifs/monkey_steals_wheel_cover.gif")
        text += "Those thieves got away! "
    text += "We get new exhibits often, so come back soon to see something new. "
    text = wrap_text(text)
    speak(text)
def get_Nearest_Petrol_Station(longitude, latitude, category, radius=2000):
    API_KEY = os.getenv('HERE_MAPS_API_KEY')
    url = f"https://places.sit.ls.hereapi.com/places/v1/browse?apiKey={API_KEY}&in={latitude},{longitude};r={radius}&cat={category}&pretty"
    x = requests.get(url)
    #petrol-station
    data = json.loads(x.text)
    nearest_place = data['results']['items'][0]['title']
    distance = data['results']['items'][0]['distance']
    text_input = f"Nearest Petrol pump is {nearest_place} at {distance} meter"
    speak(text_input)
def entrance(name, remaining):
    """Greeting node
    """
    text = "Hi %s. Welcome to the San Diego Zoo! " % name
    text += "We have a bunch of great exhibits for you today. "
    text += "Say the name of the animal you want to see to go there. "
    text += "If you want to leave at any time, just say so. "
    text += "We can go see the " + englishify(remaining, conj=False) + ". "
    text += "Where should we start?"
    text = wrap_text(text, "GoodNews")
    speak(text)
Exemple #9
0
def perform(operation):
    if operation == 1:
        # read from camera
        capture_image.start()
        text = image_to_text.text_from_image('temp/captureCropped.jpg')
        print(text)
        text_to_speech.speak(text)

    elif operation == 2:
        # send mail
        os.system("say 'waht is the mail id'")
        sendto = speech_to_text.get_text()
        sendto = sendto.replace(" ", "")

        os.system("say 'waht is the subject of the mail?'")
        subject = speech_to_text.get_text()

        os.system("say 'waht should i write in the mail?'")
        mailtext = speech_to_text.get_text()

        send_mail.mail(sendto, subject, mailtext)

    elif operation == 3:
        # what am i looking at => object identification
        capture_image.capture()
        captioning.dense_cap('temp/capture.jpg')

    elif operation == 4:
        # where am I? scene captionong
        capture_image.capture()
        captioning.scene_cap('temp/capture.jpg')

    elif operation == 5:
        # Wikipedia search
        os.system("say 'waht should i search about on the web'")
        subject = speech_to_text.get_text()
        subject = subject.rstrip()
        article = wiki_search.get_article(subject)
        article = article.rstrip()
        text_to_speech.speak(article)

    elif operation == 6:
        # who is in the frame
        face_recognisation.recognise()

    elif operation == 7:
        play.playmp3()

    # TODO add news apikey
    else:
        "do nothing, return to app loop"
def main():
    
    master.title("Welcome Human ! ")
    
    #To create labels on the master window
    
    w=tk.Label(master,text="\nWhat do you want ?\n\n1. Say Calculate or Solve Mathematical Problem--",width=50)
    w.grid(row=0,column=0)
    w1=tk.Label(master,text="2. Say Tell Me about something on Wikipedia-----")
    w1.grid(row=1,column=0)
    w2=tk.Label(master,text="3. Say Play Youtube your favourite topic----------")
    w2.grid(row=2,column=0)
    w3=tk.Label(master,text="4. Say Open Microsoft-app to open---------------")
    w3.grid(row=3,column=0)
    w4=tk.Label(master,text="5. Say Open-Firefox for browsing on mozilla------")
    w4.grid(row=4,column=0)
    w5=tk.Label(master,text="6. Say Open-Opera for browsing on Opera--------")
    w5.grid(row=5,column=0)
    w6=tk.Label(master,text="7. Say Temperature-of-Place to know temperature\n")
    w6.grid(row=6,column=0)
    
    #Welcome Note
    
    speech.speak("Welcome Human ", "en")
    speech.speak("What do you want me to do ? ", "en")
    
    #Entry
    tentry=tk.Entry(master,width=50)
    tentry.grid(row=7,column=0)
    tentry.bind('<Return>',lambda event: OnPressReturn(str(tentry.get())))
    
    #To set the focus of input on the entry widget
    
    tentry.focus()
    
    #To make a voice button for voice input by user
    
    voice_button = tk.Button(master, text="Voice",command=lambda: speak(tentry))
    voice_button.grid(row=9,column=0)
    
    #To make a search button for performing the user queries 
    
    search_button = tk.Button(master, text="Search",command=lambda: search_text(tentry))
    search_button.grid(row=10,column=0)
    
    #delete() function to clear the already filled text in entry widget
    
    tentry.delete(0,tk.END)
    
    master.mainloop()
def box_office(movie_names):
    """Movie selection. 
    """
    movie_names = [movie.lower() for movie in movie_names]
    text = "Welcome to the box office. Which movie would you like to watch? "
    text += "We have tickets for %s" % englishify(movie_names)
    text = wrap_text(text, "GoodNews")
    speak(text)
    
    while True:
        inp = get_input()
        resp = parse(inp, WKSPACE_ID)
        if get_intent(resp) == 'buy_ticket':
            entities = get_entities(resp)
            movie_choice = entities[0]
            if movie_choice in movie_names:
                break
            else:
                msg = "Sorry, we're not currently showing %s at the moment. "\
                        % movie_choice
                msg += "Please choose another movie to watch."
                speak(wrap_text(msg, "Apology"))
        else:
            e_msg = "Sorry, I didn't understand what you said. Could you try rephrasing?"
            speak(wrap_text(e_msg, "Apology"))

    text = "Here's your ticket. Enjoy the show. "
    text += "Would you like to go to the concessions or the auditorium?"
    text = wrap_text(text, "GoodNews")
    speak(text)

    return {'movie_choice': movie_choice}
def otters(remaining):
    text = "Check it out - there are otters playing basketball! "
    # runGif("ZooGifs/otter_basketball.gif")
    x = random.random()
    if x < 0.4:
        text += "Look! There is a special great white shark exhibit! "
        text += "Do you want to stop? "
        speak(wrap_text(text, 'GoodNews'))
        watch("ZooGifs/white_shark_feeding.gif")
        text = "Which animal do you want to see next? "
    else:
        text += "Which animal do you want to see next? "
    text += update_remaining(remaining, 'otters')
    speak(wrap_text(text, 'GoodNews'))
def penguins(remaining):
    text = "That penguin is a jokester. " # TODO: jokester is mispronounced
    # runGif("ZooGifs/penguin.gif")
    x = random.random()
    if x < 0.75:
        text += "Great timing. They are feeding the penguins. "
        text += "Should we stay and watch? "
        speak(wrap_text(text, 'GoodNews'))
        watch("ZooGifs/penguin_feeding.gif")
        text = "Which animal do you want to see now? "
    else:
        text += "Which animal do you want to see now? "
    text += update_remaining(remaining, 'penguins')
    speak(wrap_text(text, 'GoodNews'))
def tigers(remaining):
    text = "Look at that bird flying into the tiger enclosure. "
    # runGif("ZooGifs/tiger_and_bird.gif")
    x = random.random()
    if x < 0.5:
        text += "There are baby tigers too! "
        text += "Do you want to look? "
        speak(wrap_text(text, 'GoodNews'))
        watch("ZooGifs/baby_tiger.gif")
        text = "What exhibit should we go to from here? "
    else:
        text += "What exhibit should we go to from here? "
    text += update_remaining(remaining, 'tigers')
    speak(wrap_text(text, 'GoodNews'))
Exemple #15
0
def find_price():

    page = requests.get(URL, headers=headers)

    soup = BeautifulSoup(page.content, 'html.parser')

    price = soup.find("span", {"class": "sell-price"}).get_text()
    # print(soup.prettify())

    convertedprice = float(price[4:])

    if convertedprice > 300:
        speech.speak("Hey Alif you can buy this", "en")

    print(convertedprice)
def watch(f):
    """Ask whether the use wants to stay and watch. If yes, play the gif at `f`,
    else do nothing
    """
    while True:
        inp = get_input() 
        resp = parse(inp, WKSPACE_ID)
        intent = get_intent(resp)
        if intent == 'watch':
            print('watching %s' % f) # TODO: TEMPORARY
            # runGif(f)
            return
        elif intent  == 'no_watch':
            return
        else:
            msg = "I'm sorry I don't understand what you said. Could you rephrase?"
            speak(wrap_text(msg, 'Apology'))
Exemple #17
0
def Flames(Boy, Girl):
    flamess = {
        "friends": "best friends always together",
        "love": "wah wah ram ji...jodi kya banai",
        "affectionate":
        "ek tarfa pyaar ki ....baat he kuch aur hoti hai,\nits the most beautiful feeling in the world",
        "marriage": "milan abhi aadha, adhura hai...love birds",
        "enemies": "ladai ladai maaf karo... gandhi ji ko yaad karo",
        "sister": "bhaiya mere rakhi ka bandhan tum nibhana...hehe"
    }
    flames = [
        "friends", "love", "affectionate", "marriage", "enemies", "siblings"
    ]
    Boy = Boy.lower()
    if Boy == '-1':
        sys.exit()
    Girl = Girl.lower()
    boy = list(Boy)
    girl = list(Girl)

    try:
        common = [i for i in boy if i in girl]
        common = set(common)
    except:
        print("huh...you are just friends")
        sys.exit()
    for i in common:
        boy.remove(i)
        girl.remove(i)
    total_similar = len(boy) + len(girl)
    while (len(flames) != 1):

        count = (total_similar % len(flames)) - 1
        if count > 0:
            right = flames[count + 1:]
            left = flames[:count]
            flames = right + left
        else:
            flames = flames[:len(flames) - 1]
    print(pyfiglet.figlet_format(f"{Girl} is {flames[0]} with {Boy}"))
    say.speak(f"{Girl} is {flames[0]} with {Boy}")
    print(flamess[flames[0]])
    say.speak(flamess[flames[0]])
Exemple #18
0
def define_subject(speech_text):
    words_of_message = speech_text.split()
    words_of_message.remove('define')
    cleaned_message = ' '.join(words_of_message)
    try:
        wiki_data = wikipedia.summary(cleaned_message, sentences=5)
        regEx = re.compile(r'([^\(]*)\([^\)]*\) *(.*)')
        m = regEx.match(wiki_data)
        while m:
            wiki_data = m.group(1) + m.group(2)
            m = regEx.match(wiki_data)
        wiki_data = wiki_data.replace("'", "")
        speak(wiki_data)
    except wikipedia.exceptions.DisambiguationError as e:
        speak(
            'Can you please be more specific? You may choose something from the following.'
        )
        print(
            "Can you please be more specific? You may choose something from the following.; {0}"
            .format(e))
def auditorium(movie_choice):
    """Plays the movie
    """
    text = "Hello, ticket please! "
    if movie_choice == "inside out":
        text += "Inside Out is in theater 3 A, enjoy the show! "
    if movie_choice == "tomorrowland":
        text += "Tomorrowland is in theater 1 D, enjoy your movie! "
    if movie_choice == "minions":
        text += "Minions is in theater 3 B, enjoy the show! "
    if movie_choice == "home":
        text += "Home is in theater 1 A, enjoy your movie! "
    text = wrap_text(text, "GoodNews")
    speak(text)
    
    # TODO: need to play the movie
    return

    movie_name = p['movie choice']
    text = "Please power off your cellular devices. "
    text += "Sit back, relax, and enjoy the show."
    text = wrap_text(text, "GoodNews")
    speak(text)
    # TODO: platform specific code
    win32com.client.Dispatch("WScript.Shell").SendKeys('{ESC}')
    if movie_name == "inside out":
        webbrowser.open("https://www.youtube.com/watch?v=_MC3XuMvsDI", new=1)
        fullscreen(130)

    if movie_name == "tomorrowland":
        webbrowser.open("https://www.youtube.com/watch?v=1k59gXTWf-A", new=1)
        fullscreen(132)

    if movie_name == "minions":
        webbrowser.open("https://www.youtube.com/watch?v=eisKxhjBnZ0", new=1)
        fullscreen(167)

    if movie_name == "home":
        webbrowser.open("https://www.youtube.com/watch?v=MyqZf8LiWvM", new=1)
        fullscreen(150)
def concessions(menu):
    """Getting snacks. 
    """
    menu = [item.lower() for item in menu]
    bought = []
    text = "What can I get for you? We have " 
    text += englishify(menu)
    text = wrap_text(text, "GoodNews")
    speak(text)

    while True:
        inp = get_input() 
        resp = parse(inp, WKSPACE_ID)
        intent = get_intent(resp)
        if intent == 'order_food':
            # print('in order_food')
            entities = get_entities(resp)
            missing = []
            available = []
            for item in entities:
                if item not in menu:
                    missing.append(item)
                elif item not in bought:
                    available.append(item)
                    bought.append(item)
            missing_msg = "" 
            if missing:
                missing_msg = "Sorry we don't have %s on our menu. "\
                        % englishify(missing, conj=False)
                missing_msg = wrap_text(msg, 'Apology')
                # print(missing_msg)
            msg = "I'll get some %s for you. " % englishify(available)
            msg += "Can I get you anything else?" 
            speak(missing_msg + wrap_text(msg, 'GoodNews'))
        elif intent == 'done_ordering':
            # print('done ordering')
            break
        else:
            # print('misunderstanding')
            msg = "I'm sorry, I didn't understand what you said. Could you rephrase?"
            speak(wrap_text(msg, 'Apology'))
            
    text = "Thank you. Here's your %s. " % englishify(bought)
    text += "If you do not have your ticket yet, go to the box office."
    text += "Otherwise, you can go to the auditorium."
    text = wrap_text(text, "GoodNews")
    speak(text)

    return {'bought': bought}
Exemple #21
0
 def fun(x):
     #Get the input from the user
     lets = e1.get('1.0', END)
     #translating work starts here
     translator = Translator()
     dt1 = translator.detect(lets)
     translated = translator.translate(lets, src=dt1.lang, dest=x)
     #label
     label = Label(root,
                   text="Translated Word",
                   font=("Helvetica", 15, "bold italic"),
                   bg="white",
                   fg="red").place(x=865, y=100)
     #voice output
     a = TextBlob(translated.text)
     b = a.detect_language()
     #text output
     tex = Text(root,
                font=("fontawesome", 15, "bold italic"),
                height=15,
                width=40,
                borderwidth=10)
     tex.place(x=660, y=140)
     tex.insert(tk.END, translated.text)
     #clear the section
     b4 = Button(root,
                 text="Clear",
                 fg="blue",
                 bg="white",
                 command=lambda: tex.delete("1.0", END))
     b4.place(x=920, y=490)
     try:
         sp.speak(translated.text, b)
     except:
         messagebox.showerror(
             "Failed", "Voice Input Not Available for This Language")
def search_web(text):
    
    '''Objective-To define a function search_web() to implement queries based on browsers
       Input- String text containing query
    '''
    
    #Intializing selenium webdriver and geckodriver for firefox
    
    
    driver = webdriver.Firefox() 
    driver.implicitly_wait(1) 
    driver.maximize_window()
    
    # To find the index of keyword 'youtube'
    
    indx = text.lower().split().index('youtube') 
    query = text.split()[indx + 1:]
    
    #To join query ahead of youtube word to perform execution
    #print('+'.join(query))  
    
    driver.get("http://www.youtube.com/results?search_query=" + '+'.join(query))
    
    speech.speak("What can i do for you now?","en")
def pandas(name, remaining):
    text = "Look at all of the silly pandas! "
    # runGif("ZooGifs/pandas.gif")
    text += "Where do you want to go now %s? " % name
    text += update_remaining(remaining, 'pandas')
    speak(wrap_text(text, 'GoodNews'))
def wallet():
    """Forgot your wallet 
    """
    text = "Oh no! You forgot your wallet! We need to go back and get it. "
    text = wrap_text(text)
    speak(text)
def where_born():
    speak(
        'I was created by a magician named Dilip, in Nepal, the magical land of Himalayas.'
    )
Exemple #26
0
 def talk(self):
     global text
     text_to_speech.speak(self.text.get(), "en")
Exemple #27
0
import playsound
import argparse
import imutils
import time
import dlib
import new_nearby_places
import phone
from location import get_location
from text_to_speech import speak
#variables
sos_counter = 0
sos_called_counter = 0
nearby_places_counter = 0

#greet user
speak("hello,Atul.I am here to help you")


def sound_alarm(path):
    # play an alarm sound
    playsound.playsound(path)


def eye_aspect_ratio(eye):
    # compute the euclidean distances between the two sets of
    # vertical eye landmarks (x, y)-coordinates
    A = dist.euclidean(eye[1], eye[5])
    B = dist.euclidean(eye[2], eye[4])

    # compute the euclidean distance between the horizontal
    # eye landmark (x, y)-coordinates
Exemple #28
0
def speak_the_text():
    message = entry1.get()
    entry1.delete(0, tk.END)
    speech.speak(message, 'en')
def elephants(name, remaining):
    speak("Elephants are my favorite! Check out its cool painting.")
    # runGif("ZooGifs/GIF-Elephant-painting.gif")
    text = "What's next, " + name + "? "
    text += update_remaining(remaining, 'elephants')
    speak(wrap_text(text, "GoodNews"))
Exemple #30
0
import text_to_speech as speech
import PyPDF2
print("hello")
speech.speak("hello", "en")
print(2 + 7)
def lions(remaining):
    speak(wrap_text("Look, that lion must be hungry.", "GoodNews"))
    # runGif("ZooGifs/lion_tries_to_grab_baby.gif")
    text = "Where would you like to go now? "
    text += update_remaining(remaining, 'lions')
    speak(wrap_text(text, 'GoodNews'))
from text_to_speech import speak
from speech_to_text import *
from basic import *
import os

if __name__ == '__main__':
    #flashcards = create_dict()
    flashcards = {}
    flashcards["What is the powerhouse of the cell?"] = "Mitochondria"
    flashcards["What are you doing?"] = "Coding"
    flashcards["Best part of Hackathons?"] = "Free Stuff"
    os.system('cls' if os.name == 'nt' else "printf '\033c'")
    score, asked = 0, 0
    speak("Starting Test, say 'Quit' to end or 'Give up' to skip question")
    print("Starting Test, say 'Quit' to end or 'Give up' to skip question")
    for question in flashcards:
        speak(question)
        print(question)
        asked += 1
        words = run_mic(flashcards[question].lower())
        if words == "Correct":
            speak("Correct")
            score += 1
        elif words == 'Quit':
            break
        elif words == "Give up":
            print("Incorrect, the answer is " + flashcards[question])
    print("You scored " + str((100 * score) // len(flashcards)) + "%!")
    print("Congratulations")
def how_are_you():
    speak('I am fine, thank you.')
        'FIVE': result[0][5],
        'SIX': result[0][6],
        'SEVEN': result[0][7],
        'EIGHT': result[0][8],
        'NINE': result[0][9]
    }
    prediction = sorted(prediction.items(),
                        key=operator.itemgetter(1),
                        reverse=True)
    cv2.putText(frame, 'PREDICTED AS:', (70, 70), cv2.FONT_HERSHEY_COMPLEX,
                0.7, (255, 255, 0))
    cv2.imshow("Frame", frame)

    if prediction[0][0] == 'ZERO':
        img = cv2.imread('F:\\sjt\\labels\\zero.png')
        speak("শূন্য", lang="bn")

    elif prediction[0][0] == 'ONE':
        img = cv2.imread('F:\\sjt\\labels\\one.png')
        speak("এক", lang="bn")

    elif prediction[0][0] == 'TWO':
        img = cv2.imread('F:\\sjt\\labels\\two.png')
        speak("দুই", lang="bn")

    elif prediction[0][0] == 'THREE':
        img = cv2.imread('F:\\sjt\\labels\\three.png')
        speak("তিন", lang="bn")

    elif prediction[0][0] == 'FOUR':
        img = cv2.imread('F:\\sjt\\labels\\four.png')
Exemple #35
0
def what_is_time():
    speak("The time is " + datetime.strftime(datetime.now(), '%H:%M:%S'))
Exemple #36
0
import sys
import text_to_speech as speech
from random import randint
answer=randint(1,10)
speech.speak('Hi! this is candy. your game assistant. I will guess a number between 1 and 10 . if you guess the number correctly, you will win','en')

while True:
    try:
        print(answer)
        speech.speak('enter your guess','en')
        guess = int(input('enter your guess: '))

        if 0 < guess < 11:
            if guess==answer:
                speech.speak('wow! your guess was correct. you won! congrats!', 'en')
                break
            else:
                speech.speak('sorry! your guess is wrong. try again', 'en')
                continue
        else:
            speech.speak('please enter a number between 1 and 10', 'en')
            continue
    except ValueError:
        speech.speak('please enter a number!  not text!', 'en')
 def doi():
     window.withdraw()
     toplevel = tk.Toplevel(self.window)  # close the first window
     toplevel.geometry("953x500")
     voice(toplevel)
     speech.speak("")
Exemple #38
0
def tts_speech(text, lang):
    speak(text, lang, save=False)
    print("Маша: " + text)
 def thrd():
     speech.speak(title, lang="en", save=False)
Exemple #40
0
    Girl = input("enter girl's name:").lower()

    boy = list(Boy)
    girl = list(Girl)

    cheat.safe(Girl, Boy)

    try:
        common = [i for i in boy if i in girl]
        common = set(common)
    except:
        print("huh...you are just friends")
        sys.exit()
    for i in common:
        boy.remove(i)
        girl.remove(i)
    total_similar = len(boy) + len(girl)
    while (len(flames) != 1):

        count = (total_similar % len(flames)) - 1
        if count > 0:
            right = flames[count + 1:]
            left = flames[:count]
            flames = right + left
        else:
            flames = flames[:len(flames) - 1]
    print(f"{Girl} is {flames[0]} with {Boy}")
    say.speak(f"{Girl} is {flames[0]} with {Boy}")
    print(flamess[flames[0]])
    say.speak(flamess[flames[0]])
def monkeys(remaining):
    speak(wrap_text("Look at the cute monkeys!", "GoodNews"))
    # runGif("ZooGifs/monkey.gif")
    text = "Where to now? "
    text += update_remaining(remaining, 'monkeys')
    speak(wrap_text(text, "GoodNews"))
def who_are_you():
    messages = [
        'I am Levi, your lovely personal assistant.',
        'You already know, I am Levi', 'You ask that so many times! I am Levi.'
    ]
    speak(random.choice(messages))
def who_am_i(name):
    speak('You are ' + name + ', a brilliant person. You are best my friend.')
Exemple #44
0
        else:
            emotions.append("not happy")

        print(emotions[-10:-1])

        if "happy" not in emotions[-4:-1]:

            ## TELL A JOKE

            print("Looks like you need a joke. Here's one:")
            #content = requests.get("https://icanhazdadjoke.com/", headers={"Accept": "application/json"})
            #parsed = json.loads(content.text)
            #joke = parsed["joke"]
            joke = jokes.get_joke()
            print(joke)
            text_to_speech.speak(
                "You look unhappy, here's a joke for you. " + joke, 8000)

            ## CROP PICTURE TO YOUR FACE ONLY

            height = frame.shape[0]
            print(height)
            width = frame.shape[1]
            print(width)
            x1 = json_response[0]["faceRectangle"]["left"] - 70
            x2 = x1 + 70 + json_response[0]["faceRectangle"]["width"] + 70
            y1 = json_response[0]["faceRectangle"]["top"] - 150
            y2 = y1 + 150 + json_response[0]["faceRectangle"]["height"] + 70
            x1 = x1 if x1 > 0 else 0
            y1 = y1 if y1 > 0 else 0
            x2 = x2 if x2 < width else width - 1
            y2 = y2 if y2 < height else height - 1
def undefined():
    speak('I dont know what that means!')