コード例 #1
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
        def sendQ(question):
            answ = fnlp.nlpcall(question)
            ans.set(answ)

            ftoarduino.toarduino(answ)
            #sleep(5)
            ftexttospeech.texttospeech(answ)
            print "end"
コード例 #2
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
 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)
コード例 #3
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
        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)
コード例 #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"
コード例 #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")
コード例 #6
0
ファイル: fintro.py プロジェクト: RameshaKaru/devi
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)
コード例 #7
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
 def enter_name(self, cont):
     frame = self.frames[cont]
     frame.tkraise()
     ftexttospeech.texttospeech(
         "Please enter your name and stand on the cross")
コード例 #8
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
 def disable_auto(self, cont):
     frame = self.frames[cont]
     frame.tkraise()
     ftexttospeech.texttospeech("Auto detection is disabled")
     global flag1
     flag1 = 0
コード例 #9
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
        def showrightcom():

            ftoarduino.showright()
            #sleep(10)
            ftexttospeech.texttospeech("Showing right direction")
コード例 #10
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
        def showleftcom():

            ftoarduino.showleft()
            #sleep(10)
            ftexttospeech.texttospeech("Showing left direction")
コード例 #11
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
        def greetcom():

            ftoarduino.greet()
            #sleep(5)
            ftexttospeech.texttospeech("Greeting command")
コード例 #12
0
ファイル: displayapp2.py プロジェクト: RameshaKaru/devi
                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