예제 #1
0
    def __init__(self):
        self.PLAY_AUDIO = True
        self.personality = Personality()
        self.bot_mood = 'natural'

        self.create_gui()
        self.run()
예제 #2
0
class TransportProvider:

    def __init__(self, id):
        self.id = id
        self.personality = Personality()
        self.personality.compute_personality_indexes()
        self.nr_lost_transports = 0
        self.nr_won_transports = 0

    def increment_nr_lost_transports(self):
        self.nr_lost_transports += 1

    def increment_nr_won_transports(self):
        self.nr_won_transports += 1

    def set_min_bid(self, estimated_cost):
        self.min_bid = self.personality.get_BidFloor(estimated_cost)

    def set_max_bid(self, estimated_cost):
        self.max_bid = self.personality.get_BidCeiling(estimated_cost)

    def set_bid(self):
        self.max_bid = self.max_bid - (self.max_bid - self.min_bid) * self.personality.get_GeneratedPercentageRound()

    def get_response(self, broker_offer):
        if self.max_bid < self.min_bid:
            return "Out"
        if broker_offer >= self.max_bid:
            return "Yes"
        if broker_offer < self.max_bid:
            return "Go"

    def get_current_bid(self):
        return self.max_bid
예제 #3
0
파일: broker.py 프로젝트: randodev/aicnet
class Broker:
    def __init__(self, personality_type):
        self.personality = Personality()
        self.personality.set_personality(personality_type)
        self.personality.compute_personality_indexes()

    def set_initial_bid(self, estimated_cost):
        self.current_bid = estimated_cost

    def set_current_bid(self):
        self.current_bid = self.current_bid + (
            self.current_bid * self.personality.get_GeneratedPercentageRound())
예제 #4
0
class Human:
    def __init__(self, first_name="ND_FNAME", last_name="ND_LNAME"):

        self.personality = Personality(first_name, last_name)
        self.organs = Organs()

    def information(self):

        print("\n\nMy name is",
              self.personality.get_name()[0],
              self.personality.get_name()[1] + '.', "i'm",
              self.personality.get_nationality() + '.', "my eye color is",
              self.organs.eye.get_color() + '.', "and my face shape is",
              self.organs.head.get_shape() + '.\n')
예제 #5
0
 def test_load_states(self):
     config = Configuration()
     personality = Personality(config)
     personality.do_not_save = True
     states = [{
         "name": "introduction"
         },{
             "type": "audio",
             "title": "Live Radio",
             "filename": "live_stream.json",
             "on_enter": "You are now listening to live radio.",
             "on_empty": "There are no radio stations available."
         }, {
             "type": "audio",
             "title": "Saved Programmes",
             "playlist": {
                 "tracks": [
                     { "directory": "%HOME%/Radio_Uncompressed/keep", "extensions": "m4a", "include-subdir": True }
                 ],
                 "orderby": "name"
             },
             "on_enter": "You are now listening to your favourites.",
             "on_empty": "There are no favourites chosen yet."
         },
         {
             "type": "audio",
             "title": "Latest Programmes",
             "playlist": {
                 "tracks": [
                     { "directory": "%HOME%/Radio_Uncompressed/tmp", "extensions": "m4a", "include-subdir": True }
                 ],
                 "orderby": ["date", "desc"]
             },
             "on_enter": "You are now listening to the latest programmes.",
             "on_empty": "There are no programmes downloaded yet."
         }
     ]
     personality.set_states(states)
     item = StatesFactory.create(config, personality)
     context = UserContext(item)
     context.personality = personality
     config.context = context
     logging.debug("Starting state context")
     context.start()
     for ii in range(0,4):
         time.sleep(3)
         logging.debug("*************  Next state context {}".format(ii))
         context.on_play_down()
         context.on_play_up()
def algorithm(df, params):
    """
    wrapper function to put each individual algorithm inside
    :param df: dataframe that contains all the input dataset
    :param params: algorithm specific parameters
    :return: a dictionary of { outputname: output content in memory }
    """
    output = {}

    PD = Personality(df, params['column'])
    predicted = PD.predict(params['algorithm'])
    output['personality'] = predicted
    output['average'] = PD.average(predicted)

    return output
예제 #7
0
 def test_play(self):
     config = Configuration()
     p = Personality(config)
     state = SpeakingClockState(config, p)
     state.on_enter();
     time.sleep(12)
     state.on_exit();
 def test_play(self):
     config = Configuration()
     p = Personality(config)
     state = IntroductionState.create(config, p, {})
     state.on_enter()
     time.sleep(3)
     state.on_exit()
예제 #9
0
 def test_load_states(self):
     config = Configuration()
     personality = Personality(config)
     personality.do_not_save = True
     item = StatesFactory.create(config, personality)
     context = UserContext(item)
     context.personality = personality
     config.context = context
     logging.debug("Starting state context")
     context.start()
     for ii in range(0,len(personality.json["states"])):
         time.sleep(3)
         logging.debug("*************  Next state context {}".format(ii))
         context.on_play_down()
         context.on_play_up()
     time.sleep(3)
 def test_move_automatically_onto_next_track(self):
     config = Configuration()
     p = Personality(config)
     empty_playlist = {
         "type": "audio",
         "title": "Test progress",
         "filename": "checkpoint2.json",
         "playlist": {
             "tracks": [{
                 "directory": "/home/pi/Music/dance",
                 "extensions": ["m4a", "wav"],
                 "include-subdir": True
             }],
             "orderby": ["date", "desc"]
         },
         "on_enter": "You are now listening to a test list.",
         "on_empty": "There are no favourites chosen yet."
     }
     state = PlaylistStreamState.create(config, p, empty_playlist)
     logging.debug("creating")
     print(state.json)
     state.on_enter()
     time.sleep(15)
     state.is_finished()
     time.sleep(15)
     state.is_finished()
     time.sleep(15)
     print(state.json)
예제 #11
0
def generate_player():
	r = random(); name = ''
	if r < 0.5: name = rand_male_name() + ' ' + rand_surname()
	else: name = rand_female_name() + ' ' + rand_surname()

	pos = Pos.rand_position()

	weight, height = 0, 0
	if pos == Pos.CATCHER: weight, height = catcher_height_weight()
	elif Pos.is_infield(pos): weight, height = infield_height_weight()
	elif Pos.is_outfield(pos): weight, height = outfield_height_weight()
	else: weight, height = pitcher_height_weight()

	birthdate = generate_birthdate(start_date.year)

	bats, throws = generate_bats_throws()

	years_in_majors = int( gauss(years_old(birthdate, start_date) - 23, 2) )
	if years_in_majors < 0: years_in_majors = 0
	caps = Capabilities.generate_all_caps(height, weight, birthdate, start_date, years_in_majors, pos)

	pos_caps = PositionCapabilities.generate_pos_caps(pos)

	contract = Contract(get_FA(), 0, 0)

	personality = Personality.rand_personality()
 
	return Player(name, pos, height, weight, birthdate, bats, throws, caps, pos_caps, contract, personality)
예제 #12
0
 def test_play(self):
     config = Configuration()
     p = Personality(config)
     state = EndState()
     state.on_enter()
     time.sleep(3)
     state.on_exit()
예제 #13
0
 def test_play(self):
     config = Configuration()
     p = Personality(config)
     state = AnnounceState(config, p)
     state.message = "Testing announcement"
     state.on_enter()
     time.sleep(3)
     state.on_exit()
예제 #14
0
    def __init__(self, in_stats={}):
        """Create a new monster, setting stats, etc. as needed."""
        self.lvl = 0
        # self.awr might not even need to be a thing, remove this if it ends up not mattering
        self.awr = 0# awareness, this is a thing for conversations / progress through the game
        # it might make more sense to hold info for conversations flow in shared.state, but I'm not sure
        # depends on how this number interacts with monster stuff
        self.personality = Personality.random()
        self.name = Personality.generateName(self.personality)
        self.skin = Skin.random(self.personality)
        # access the SkinTone with self.skin[self.lvl]
        self.mood = Mood.Neutral# mood might only be changed by and do stuff during battles / convos? maybe

        self.stats = {x: 2 for x in self.__class__.main_stats}
        self.stats['drv'] = self.__class__.drv_max//2
        self._levelStats()
        self.stats.update(in_stats)
        self.setHealth()

        self.sprite_groups = tuple(random.choice(('A','B','C')) for x in range(5))
        self._setSpritePaths()
        self._setSprites()
예제 #15
0
 def test_play(self):
     config = Configuration()
     p = Personality(config)
     state_config = {
         "name": "audio",
         "title": "Latest Programmes",
         "path": "%HOME%/Radio_Uncompressed/tmp",
         "extensions": "m4a",
         "orderby": ["date", "desc"]
     }
     state = AudioState.create(config, p, state_config)
     state.on_enter()
     time.sleep(3)
     state.on_exit()
예제 #16
0
 def test_empty_list(self):
     config = Configuration()
     p = Personality(config)
     state = LiveStreamState.create(config, p, {})
     empty_playlist = {"playlist": []}
     state.json = empty_playlist
     state.on_enter()
     for attempt in range(0, 2):
         time.sleep(3)
         logging.debug(
             "attempting to move to next track in empty livestream")
         state.on_next_track_down()
         state.on_next_track_up()
     time.sleep(3)
     state.on_exit()
예제 #17
0
 def test_play(self):
     """Test the alarm by itself"""
     config = Configuration()
     p = Personality(config)
     now = datetime.datetime.now()
     logging.debug(now)
     one_minute_from_now = now + datetime.timedelta(minutes=1)
     one_minute_from_now_str = one_minute_from_now.strftime("%H:%M")
     logging.debug(one_minute_from_now)
     logging.debug(one_minute_from_now_str)
     alarm_schedule = [
         {
             "when": [ one_minute_from_now_str ],
             "action": "play",
             "args": {
                 "track": CURDIR+"/../../sounds/piano2.m4a",
                 "run_once": True
             }
         }
     ]
     config.alarm.update_schedule(alarm_schedule)
     config.alarm.start()
     logging.debug("please wait, while we test the alarm")
     time.sleep(90)
예제 #18
0
 def __init__(self, id):
     self.id = id
     self.personality = Personality()
     self.personality.compute_personality_indexes()
     self.nr_lost_transports = 0
     self.nr_won_transports = 0
예제 #19
0
class Chatbot:
    def __init__(self):
        self.PLAY_AUDIO = True
        self.personality = Personality()
        self.bot_mood = 'natural'

        self.create_gui()
        self.run()

    # get basic lemma from sentence
    def clean_up_sentence(self, sentence):
        sentence_words = nltk.word_tokenize(sentence)
        sentence_words = [
            lemmatizer.lemmatize(word.lower()) for word in sentence_words
        ]
        return sentence_words

    # return bag of words array: 0 or 1 for each word in the bag that exists in the sentence

    def bow(self, sentence, words, show_details=True):
        # tokenize the pattern
        sentence_words = self.clean_up_sentence(sentence)
        # bag of words - matrix of N words, vocabulary matrix
        bag = [0] * len(words)
        for s in sentence_words:
            for i, w in enumerate(words):
                if w == s:
                    # assign 1 if current word is in the vocabulary position
                    bag[i] = 1
                    if show_details:
                        print("found in bag: %s" % w)
        return (np.array(bag))

    # run deep neural network trough learned model
    def predict_class(self, sentence, model):
        # filter out predictions below a threshold
        p = self.bow(sentence, words, show_details=False)
        res = model.predict(np.array([p]))[0]

        # Increased threshold to avoid misunderstanding
        ERROR_THRESHOLD = 0.97
        results = [[i, r] for i, r in enumerate(res) if r > ERROR_THRESHOLD]
        # sort by strength of probability
        results.sort(key=lambda x: x[1], reverse=True)
        return_list = []

        # check if user intent is clear
        if len(results) > 0:
            for r in results:
                return_list.append({
                    "intent": classes[r[0]],
                    "probability": str(r[1])
                })
        else:
            return_list.append({"intent": 'noanswer', "probability": '1'})

        return return_list

    def getResponse(self, ints, intents_json):
        tag = ints[0]['intent']
        list_of_intents = intents_json['intents']
        for i in list_of_intents:
            if (i['tag'] == tag):
                result = random.choice(i['responses'])
                break
        return result

    def chatbot_response(self, msg):
        ints = self.predict_class(msg, model)
        print('ints:', ints)

        # special states indicates command
        res = self.getResponse(ints, intents)
        return res

    # Creating GUI with tkinter

    def send(self, _=None):
        msg = self.EntryBox.get("1.0", 'end-1c').strip()
        self.EntryBox.delete("0.0", END)

        if msg != '':
            self.ChatLog.config(state=NORMAL)
            self.ChatLog.insert(END, "You: " + msg + '\n\n')
            self.ChatLog.config(foreground="#442265", font=("Verdana", 12))

            res = self.chatbot_response(msg)
            self.ChatLog.insert(END, "Bot: " + res + '\n\n')

            self.ChatLog.config(state=DISABLED)
            self.ChatLog.yview(END)

        # update emotional state of chatbot
        self.update_emotion_state(msg)
        if self.PLAY_AUDIO:
            self.bot_speak(msg)

    # render emotion of agent
    def update_emotion_state(self, text):
        # get lemmas from sentence
        words = self.clean_up_sentence(text)
        feeling = self.personality.word_to_mood(words)
        print(feeling)
        if feeling is not None:
            key_name = list(feeling)[0]
            bot_mood = self.personality.get_mood(insert_emotion=key_name,
                                                 prob=feeling[key_name] * 5)
        else:
            bot_mood = self.personality.get_mood()

        self.ChatLog2.config(state=NORMAL)
        self.ChatLog2.config(foreground="#442265", font=("Verdana", 12))
        self.ChatLog2.delete("0.0", END)
        self.ChatLog2.insert(END, 'Chat bot is:' + bot_mood)
        self.ChatLog2.config(state=DISABLED)
        self.ChatLog2.yview(END)

    # speak text
    def bot_speak(self, msg):
        self.personality.speak_with_mood(msg)

    def toggle_speech(self):
        self.PLAY_AUDIO ^= 1

    def create_gui(self):
        self.base = Tk()
        self.base.title("Chat bot")
        self.base.geometry("400x500")
        self.base.resizable(width=FALSE, height=FALSE)

        # Create Chat window
        self.ChatLog = Text(
            self.base,
            bd=0,
            bg="white",
            height="8",
            width="50",
            font="Arial",
        )

        self.ChatLog2 = Text(
            self.base,
            bd=0,
            bg="white",
            height="8",
            width="50",
            font="Arial",
        )

        self.ChatLog.config(state=DISABLED)
        self.ChatLog2.config(state=DISABLED)

        # Bind scrollbar to Chat window
        self.scrollbar = Scrollbar(self.base,
                                   command=self.ChatLog.yview,
                                   cursor="heart")

        # Current emotion
        self.scrollbar2 = Scrollbar(self.base,
                                    command=self.ChatLog.yview,
                                    cursor="heart")

        self.ChatLog['yscrollcommand'] = self.scrollbar.set
        self.ChatLog2['yscrollcommand'] = self.scrollbar2.set

        # Create Button to send message
        self.SendButton = Button(self.base,
                                 font=("Verdana", 12, 'bold'),
                                 text="Send",
                                 width="12",
                                 height=5,
                                 bd=0,
                                 bg="#32de97",
                                 activebackground="#3c9d9b",
                                 fg='#ffffff',
                                 command=self.send)

        # create audio button

        self.AudioButton = Button(self.base,
                                  font=("Verdana", 12, 'bold'),
                                  text="Talk",
                                  width="12",
                                  height=5,
                                  bd=0,
                                  bg="#32de97",
                                  activebackground="#3c9d9b",
                                  fg='#ffffff',
                                  command=self.toggle_speech)

        # Create the box to enter message
        self.EntryBox = Text(self.base,
                             bd=0,
                             bg="white",
                             width="29",
                             height="5",
                             font="Arial",
                             fg='black')
        self.EntryBox.bind("<Return>", self.send)

        # Place all components on the screen
        self.scrollbar.place(x=376, y=6, height=386)
        self.ChatLog.place(x=6, y=6 + 20, height=386 - 20, width=370)
        self.ChatLog2.place(x=6, y=6, height=20, width=300)
        # insert button at 300 width

        self.EntryBox.place(x=128, y=401, height=90, width=265)
        self.SendButton.place(x=6, y=401, height=90)
        self.AudioButton.place(x=300, y=6, height=20, width=70)

    def run(self):
        # TKinter main loop
        self.base.mainloop()
예제 #20
0
def get_personality():
    text = request.args.get("text")
    p = Personality()
    token = p.auth(3459, 'vmp75o3e1mqq9adt4968vqpdvv')
    prediction_result = p.predict_from_text(token, text)
    return json.dumps(prediction_result, indent=4)
 def __init__(self, name):
     Personality.__init__(self, name)
     self.age = random.randint(13, 21)
     self.probSpellingMistake = random.randint(1, 5)
예제 #22
0
def predict(model):
    c = Crop()
    eye = Screen()
    zumi = Zumi()
    camera = Camera(64, 64)
    personality = Personality(zumi, eye)

    cnt = 0
    prev_label = -1
    cnt_none_crop = 0
    try:
        while True:
            zumi.reset_drive()
            img = camera.run()
            crop_img = c.crop(img)
            if crop_img is None:

                if cnt_none_crop == 0:
                    personality.look_around_open01()
                elif cnt_none_crop == 1:
                    personality.look_around_open02()
                elif cnt_none_crop == 2:
                    personality.look_around_open03()
                elif cnt_none_crop == 3:
                    personality.look_around_open04()

                prev_label = -1
                print(cnt, prev_label, cnt_none_crop)
                cnt_none_crop += 1
                cnt_none_crop %= 4

                continue
            else:
                cnt_none_crop = 0

            x = Image.fromarray(crop_img)
            x = np.expand_dims(x, axis=0)
            preds = model.predict_classes(x)
            print(landmark[preds[0]])

            if prev_label == preds[0]:
                cnt += 1
                if cnt > 2:
                    print(eye.EYE_IMAGE_FOLDER_PATH + "sad1.ppm")
                    print("reaction!!!!")
                    eye.draw_image(
                        eye.path_to_image(LAND_PATH + landmark[preds[0]] +
                                          ".jpg"))
                    time.sleep(2)
                    if landmark[preds[0]] == 'eiffel':
                        zumi.turn_right(90)
                    elif landmark[preds[0]] == 'nyc':
                        zumi.turn_right(45)
                    elif landmark[preds[0]] == 'seattle':
                        zumi.turn_left(45)
                    elif landmark[preds[0]] == 'china':
                        zumi.turn_left(90)

                    time.sleep(.5)
                    zumi.forward(10, duration)
                    time.sleep(.5)
                    personality.celebrate()
                    time.sleep(.5)
                    zumi.reverse(10, duration)
                    time.sleep(.5)

                    if landmark[preds[0]] == 'eiffel':
                        zumi.turn_left(90)
                    elif landmark[preds[0]] == 'nyc':
                        zumi.turn_left(45)
                    elif landmark[preds[0]] == 'seattle':
                        zumi.turn_right(45)
                    elif landmark[preds[0]] == 'china':
                        zumi.turn_right(90)

                    cnt = 0
                else:
                    personality.reading(
                        eye.path_to_image(READ_PATH + "reading_" + str(cnt) +
                                          ".PPM"))
            else:
                cnt = 0
                prev_label = preds[0]

    except KeyboardInterrupt:
        camera.shutdown()
        eye.draw_text("")
        zumi.stop()
        print("\nExiting...")
    except:
        camera.shutdown()
        eye.draw_text("")
        zumi.stop()
        print("\nExiting...")
예제 #23
0
파일: broker.py 프로젝트: randodev/aicnet
 def __init__(self, personality_type):
     self.personality = Personality()
     self.personality.set_personality(personality_type)
     self.personality.compute_personality_indexes()
예제 #24
0
    def execute(self):
        print(" [...] Start")
        # ---------------------
        # 1. Create all actors
        actorparameters = dict()
        # >>>> Talia
        personality = Personality()
        personality.setAlignmentValues(70, 70)

        actorparameters['identity'] = 'talia'
        actorparameters['personality'] = personality
        actorparameters[
            'goals'] = None  # <-- this should be regenerated every chapter
        actorparameters['status'] = 'ACTIVE'
        actorparameters['domprob'] = copy.copy(
            self.domainproblem
        )  # <-- for now, all actors have the same knowledgebase

        self.createNewActor(actorparameters)

        # >>>> Vince
        personality = Personality()
        personality.setAlignmentValues(70, -45)

        actorparameters['identity'] = 'vince'
        actorparameters['personality'] = personality
        actorparameters[
            'goals'] = None  # <-- this should be regenerated every chapter
        actorparameters['status'] = 'ACTIVE'
        actorparameters['domprob'] = copy.copy(
            self.domainproblem
        )  # <-- for now, all actors have the same knowledgebase

        self.createNewActor(actorparameters)

        # >>>> Rory
        personality = Personality()
        personality.setAlignmentValues(0, 45)

        actorparameters['identity'] = 'rory'
        actorparameters['personality'] = personality
        actorparameters[
            'goals'] = None  # <-- this should be regenerated every chapter
        actorparameters['status'] = 'ACTIVE'
        actorparameters['domprob'] = copy.copy(
            self.domainproblem
        )  # <-- for now, all actors have the same knowledgebase

        self.createNewActor(actorparameters)

        # >>>> Gargax
        personality = Personality()
        personality.setAlignmentValues(-99, -99)

        actorparameters['identity'] = 'gargax'
        actorparameters['personality'] = personality
        actorparameters[
            'goals'] = None  # <-- this should be regenerated every chapter
        actorparameters['status'] = 'ACTIVE'
        actorparameters['domprob'] = copy.copy(
            self.domainproblem
        )  # <-- for now, all actors have the same knowledgebase

        self.createNewActor(actorparameters)

        # ---------------------
        # 2. Define chapters
        #   2.1 Chapter goals
        #   2.2 Chapter actors
        # active actors (will perform actions)
        # passive actors (will be affected by active actors)

        # ---------------------
        # 3. Loop runChapter, chaining them together
        #   result_state -> new_initial_state

        print(" [...] End")
예제 #25
0
    def __init__(self, first_name="ND_FNAME", last_name="ND_LNAME"):

        self.personality = Personality(first_name, last_name)
        self.organs = Organs()
예제 #26
0
 def test_midday_2(self):
     config = Configuration()
     p = Personality(config)
     state = SpeakingClockState(config, p)
     when = datetime.datetime.today()
     state.tell(when.replace(day=3,hour=12,minute=13))
예제 #27
0
 def test_evening(self):
     config = Configuration()
     p = Personality(config)
     state = SpeakingClockState(config, p)
     when = datetime.datetime.today()
     state.tell(when.replace(hour=19,minute=23))
예제 #28
0
 def test_midnight_3(self):
     config = Configuration()
     p = Personality(config)
     state = SpeakingClockState(config, p)
     when = datetime.datetime.today()
     state.tell(when.replace(hour=0,minute=54))
예제 #29
0
 def __init__(self, name):
     Personality.__init__(self, name)
     self.age = random.randint(29, 40)
     self.probSpellingMistake = random.randint(5, 7)
예제 #30
0
def predict(model,Reroute=False):
    c = Crop()
    eye = Screen()
    zumi = Zumi()
    camera = Camera(64, 64)
    personality = Personality(zumi, eye)

    cnt = 0
    prev_label = -1
    cnt_none_crop = 0
    try:
        while True:
            img = camera.run()
            crop_img = c.crop(img)
            if crop_img is None:

                if cnt_none_crop == 0:
                    personality.look_around_open01()
                elif cnt_none_crop == 1:
                    personality.look_around_open02()
                elif cnt_none_crop == 2:
                    personality.look_around_open03()
                elif cnt_none_crop == 3:
                    personality.look_around_open04()

                prev_label = -1
                print(cnt, prev_label, cnt_none_crop)
                cnt_none_crop += 1
                cnt_none_crop %= 4

                continue
            else:
                cnt_none_crop = 0

            x = Image.fromarray(crop_img)
            x = np.expand_dims(x, axis=0)
            preds = model.predict_classes(x)
            print(landmark[preds[0]])

            if prev_label == preds[0]:
                cnt += 1
                if cnt > 2:
                    print(eye.EYE_IMAGE_FOLDER_PATH + "sad1.ppm")
                    print("reaction!!!!")
                    eye.draw_image(eye.path_to_image(LAND_PATH + landmark[preds[0]] + ".jpg"))
                    time.sleep(2)
                    route = Route_new()
                    if Reroute:
                        print("go with rerouting")
                        if landmark[preds[0]] == 'eiffel':
                            route.driving(route.start_node, route.paris)
                        elif landmark[preds[0]] == 'nyc':
                            route.driving(route.start_node, route.NY)
                        elif landmark[preds[0]] == 'seattle':
                            route.driving(route.start_node, route.seattle)
                        elif landmark[preds[0]] == 'china':
                            route.driving(route.start_node, route.china)
                        else:
                            route.driving(route.start_node, route.bigben)
                        zumi.stop()
                        personality.celebrate()
                        time.sleep(.5)
                    else:
                        print("no reroute")
                        if landmark[preds[0]] == 'eiffel':
                            route.driving_without_reroute(route.start_node, route.paris)
                            route.park_right()
                        elif landmark[preds[0]] == 'nyc':
                            route.driving_without_reroute(route.start_node, route.NY)
                            route.park_right()
                        elif landmark[preds[0]] == 'seattle':
                            route.driving_without_reroute(route.start_node, route.seattle)
                            route.park_left()
                        elif landmark[preds[0]] == 'china':
                            route.driving_without_reroute(route.start_node, route.china)
                            route.park_left()
                        else:
                            route.driving_without_reroute(route.start_node, route.bigben)
                            route.park_right()
                        zumi.stop()
                        personality.celebrate()
                        time.sleep(.5)

                    cnt = 0
                else:
                    personality.reading(eye.path_to_image(READ_PATH + "reading_" + str(cnt) + ".PPM"))
            else:
                cnt = 0
                prev_label = preds[0]

    except KeyboardInterrupt:
        camera.shutdown()
        eye.draw_text("")
        zumi.stop()
        print("\nExiting...")
    except:
        camera.shutdown()
        eye.draw_text("")
        zumi.stop()
        print("\nExiting...")