Example #1
0
        def sendQ(question):
            answ = fnlp.nlpcall(question)
            ans.set(answ)

            ftoarduino.toarduino(answ)
            #sleep(5)
            ftexttospeech.texttospeech(answ)
            print "end"
Example #2
0
 def sendName(name):
     # sentence = 'My name is ' + name
     # answ = fnlp.nlpcall(sentence)
     # ans.set(answ)
     answ = "Please stand on the cross and look at my eyes " + name
     ans.set(answ)
     ftexttospeech.texttospeech(answ)
     unknown_user.saveface(name)
     answ = "Your name was saved and now you may ask questions."
     ftexttospeech.texttospeech(answ)
Example #3
0
        def audioQ():
            flag = 0
            nlp_out = ''
            frecord.record()

            # text_out = fspeechtotext.speechtotext(audio_file, PATH)
            # nlp_out = fnlp.nlpcall(text_out)
            # ans.set(nlp_out)
            # ftexttospeech.texttospeech(nlp_out)
            #ftoarduino.toarduino(nlp_out)

            signal.signal(signal.SIGALRM, handler)
            signal.alarm(20)
            try:
                text_out = fspeechtotext.speechtotext(audio_file, PATH)
            except Exception, exc:
                print exc
                text_out = "Timeout. Please try again"
                ans.set("Timeout. Please try again")
                ftexttospeech.texttospeech(text_out)
Example #4
0
def autodet():
    while (True):
        if displayapp2.flag1 == 1:
            print "auto detect"
            pathlist = autodetect.auto_run()
            if pathlist == None:
                displayapp2.flag1 = 0
            else:
                print pathlist[1]

                text_out = fspeechtotext.speechtotext(pathlist[1], pathlist[0])
                if text_out != '':
                    nlp_out = fnlp.nlpcall(text_out)
                    convo = nlp_out.split()
                    print "to arduino"
                    ftoarduino.toarduino(nlp_out)
                    #sleep(5)
                    ftexttospeech.texttospeech(nlp_out)
                    print "end"
                    if "Bye" in convo:
                        break
                else:
                    print "Audio is not properly captured"
Example #5
0
def proxface():

    ftoarduino.endConv()

    while (1):

        while ser.in_waiting:
            list1 = []
            comd = ''
            a = ser.read()
            if (a != '<'):
                continue
            elif (a == '<'):
                while (1):
                    if ser.in_waiting:
                        cha = ser.read()
                        if cha == '>':
                            break
                        else:
                            list1.append(cha)
            print list1
            for i in range(len(list1)):
                comd = comd + list1[i]
            print comd

            if comd == "det":

                signal.signal(signal.SIGALRM, handler)
                signal.alarm(25)
                nofaceflag = 0
                try:
                    video_capture = cv2.VideoCapture(0)
                    person = live_run.runface(video_capture)
                except Exception, exc:
                    print exc
                    video_capture.release()
                    cv2.destroyAllWindows()
                    nofaceflag = 1
                    ftoarduino.endConv()
                    print "face not detected1"
                signal.alarm(0)

                if nofaceflag == 0:
                    if person == "unknown":
                        print "unknown"
                        ftoarduino.greet()
                        text_out = "Welcome to the department of E N T C."
                        print text_out
                        ftexttospeech.texttospeech(text_out)
                        ftoarduino.middle()
                        sleep(8)
                        ftexttospeech.texttospeech(
                            "Can you please enter your name?")
                    elif person == "0":

                        print "exit face"
                        ftoarduino.endConv()

                    else:

                        print "name done"
                        ftoarduino.greet()
                        text_out = "Welcome to the department of E N T C " + person
                        print text_out
                        ftexttospeech.texttospeech(text_out)
                        ftoarduino.middle()
                        sleep(8)
                        ftexttospeech.texttospeech("What can I do for you")

        def handler(signum, frame):
            print "Face not detected"
            raise Exception("end of time")
Example #6
0
def intros():
    sleep(4)
    ftexttospeech.texttospeech(Text0)
    sleep(1.5)
    ftexttospeech.texttospeech(Text1)
    sleep(1)
    ftexttospeech.texttospeech(Text2)
    sleep(1.5)
    ftexttospeech.texttospeech(Text3)
    sleep(1)
    ftexttospeech.texttospeech(Text4)
    sleep(1.5)
    ftexttospeech.texttospeech(Text5)
    sleep(1)
    ftexttospeech.texttospeech(Text6)
Example #7
0
 def enter_name(self, cont):
     frame = self.frames[cont]
     frame.tkraise()
     ftexttospeech.texttospeech(
         "Please enter your name and stand on the cross")
Example #8
0
 def disable_auto(self, cont):
     frame = self.frames[cont]
     frame.tkraise()
     ftexttospeech.texttospeech("Auto detection is disabled")
     global flag1
     flag1 = 0
Example #9
0
        def showrightcom():

            ftoarduino.showright()
            #sleep(10)
            ftexttospeech.texttospeech("Showing right direction")
Example #10
0
        def showleftcom():

            ftoarduino.showleft()
            #sleep(10)
            ftexttospeech.texttospeech("Showing left direction")
Example #11
0
        def greetcom():

            ftoarduino.greet()
            #sleep(5)
            ftexttospeech.texttospeech("Greeting command")
Example #12
0
                text_out = "Timeout. Please try again"
                ans.set("Timeout. Please try again")
                ftexttospeech.texttospeech(text_out)
            else:
                print text_out
                nlp_out = fnlp.nlpcall(text_out)
                ans.set(nlp_out)
                # ftexttospeech.texttospeech(nlp_out)
                flag = 1
            signal.alarm(0)

            print "to arduino"
            if flag == 1:
                ftoarduino.toarduino(nlp_out)
                #sleep(5)
                ftexttospeech.texttospeech(nlp_out)
                print "end"

        def handler(signum, frame):
            print "Timeout! Please try again"
            raise Exception("end of time")

        #     audi = multiprocessing.Process(target=audioprocess)
        #
        #     audi.start()
        #     audi.join(25)
        #
        #     if audi.is_alive():
        #         global nlp_out
        #         nlp_out= "Timeout. Please try again"
        #         print nlp_out