def main():
    Core = CorePy("","kppv")
    sys.stdout.write("CorePy initialized ...\n")
    send_to_electron = Talk(1)

    send_to_electron.send(b'SYNC')

    urls = send_to_electron.recv()
    urls = json.loads(urls)

    sys.stdout.write("\nNumber of files: "+str(len(urls)))
    sys.stdout.write(str(urls))

    for i in range(0, len(urls)):
        run(urls[i], Core)
        data = tojson([Core.image.content_list, Core.image.class_list])
        # send data to electron and receive output
        send_to_electron.send(str(data))
        output = send_to_electron.recv()
        # get the right format!
        output = json.loads(output)
        update_class_list(output,Core)
        Core.train_predictor()

    # data = tojson([Core.image.content_list, Core.image.class_list])

    # send_to_electron.send(str(data))

    # message = send_to_electron.syncservice.recv()
    # sys.stdout.write(str(message)+"\n")

    send_to_electron.close()
    pass
Exemple #2
0
def main():
    # import Queue
    import Queue
    Core = CorePy("", "kppv")

    processes = [
        mp.Process(target=self.worker, args=(x, inputs, output))
        for x in range(4)
    ]

    urls = Queue()

    # get urls and add to queue
    getUrls = Talk(1)

    # send content boxes
    sendContentBoxes = Talk(1)

    # recieve selected content boxes
    # extract sub-images from the higher dimension Image
    # see TableFactory.py for the rest

    # once we have the csv file -> send it back

    url = ""
    getContentBoxes(Core, url)
    sendContentBoxes.send("content boxes")

    # Core = CorePy("","kppv")
    # sys.stdout.write("CorePy initialized ...\n")
    # send_to_electron = Talk(1)
    #
    # send_to_electron.send(b'SYNC')
    #
    # urls = send_to_electron.recv()
    # urls = json.loads(urls)
    #
    # sys.stdout.write("\nNumber of files: "+str(len(urls)))
    # sys.stdout.write(str(urls))
    #
    # for i in range(0, len(urls)):
    #     run(urls[i], Core)
    #     data = tojson([Core.image.content_list, Core.image.class_list])
    #     # send data to electron and receive output
    #     send_to_electron.send(str(data))
    #     output = send_to_electron.recv()
    #     # get the right format!
    #     output = json.loads(output)
    #     update_class_list(output,Core)
    #     Core.train_predictor()
    #
    # send_to_electron.close()
    pass
Exemple #3
0
def main():
    # import Queue
    import Queue
    Core = CorePy("","kppv")

    processes = [mp.Process(target=self.worker, args=(x, inputs, output)) for x in range(4)]

    urls = Queue()

    # get urls and add to queue
    getUrls = Talk(1)

    # send content boxes
    sendContentBoxes = Talk(1)

    # recieve selected content boxes
    # extract sub-images from the higher dimension Image
    # see TableFactory.py for the rest

    # once we have the csv file -> send it back

    url = ""
    getContentBoxes(Core,url)
    sendContentBoxes.send("content boxes")



    # Core = CorePy("","kppv")
    # sys.stdout.write("CorePy initialized ...\n")
    # send_to_electron = Talk(1)
    #
    # send_to_electron.send(b'SYNC')
    #
    # urls = send_to_electron.recv()
    # urls = json.loads(urls)
    #
    # sys.stdout.write("\nNumber of files: "+str(len(urls)))
    # sys.stdout.write(str(urls))
    #
    # for i in range(0, len(urls)):
    #     run(urls[i], Core)
    #     data = tojson([Core.image.content_list, Core.image.class_list])
    #     # send data to electron and receive output
    #     send_to_electron.send(str(data))
    #     output = send_to_electron.recv()
    #     # get the right format!
    #     output = json.loads(output)
    #     update_class_list(output,Core)
    #     Core.train_predictor()
    #
    # send_to_electron.close()
    pass
Exemple #4
0
 def __init__(self):
     super(LastSession, self).__init__()
     self._name = 'Last Session'
     self._start_time = datetime.datetime(year=1900,
                                          month=1,
                                          day=1,
                                          hour=17)
     self._duration = datetime.timedelta(minutes=0)
     self._talk_list = [Talk('Networking Event', '0min', '05:00PM')]
Exemple #5
0
 def __init__(self):
     super(NoonSession, self).__init__()
     self._name = 'Noon Session'
     self._start_time = datetime.datetime(year=1900,
                                          month=1,
                                          day=1,
                                          hour=12)
     self._duration = datetime.timedelta(hours=1)
     self._talk_list = [Talk('Lunch', '60min', '12:00PM')]
Exemple #6
0
def build_talks_sesions():
    """Initialize all talks and sesssions objects
    """
    sessions = list(map(lambda x: Session(x), [180, 240, 180, 240]))

    talks = []
    with open('input.txt') as f:
        for line in f:
            talks.append(Talk(line.strip()))

    return sessions, talks
Exemple #7
0
 def __init__(s):
       #Dane:
       win=Window("todo",600,600,0,0)
       master=win.getMaster()
       todo=ToDo()
       
       topB=TopBar(master,todo)
       desk=Desk(master)
       C=desk.getC()
       
       optionB=OptionBar(master,desk,todo)
       talk=Talk(master,todo,desk)
       #testowanie
       
       #testowanie
       win.loop()
Exemple #8
0
 def read_sample_input(self, file_path=None):
     file_path = file_path if file_path else self.input_path
     talk_list = []
     with codecs.open(file_path, 'r', encoding='utf-8') as f1:
         content = f1.readlines()
         for line in content:
             line = line.strip('\n')
             line_array = line.split(' ')
             duration = line_array[-1]
             title = ' '.join(line_array[0:-1])
             talk = Talk(title, duration)
             talk_dict = {'talk': talk, 'use': False}
             talk_list.append(talk_dict)
     self._check_talk(talk_list)
     self._talk_list = talk_list
     self._talk_list = self._sort_talk_by_duration()
Exemple #9
0
class Wink:

    talk = Talk()

    def __init__(self):
        self.blink_start = 0
        self.t1 = 0
        self.t2 = 0

    def detectWink(self, max):
        if (max > 400 and self.blink_start == 0):
            self.blink_start = 1
            #print('Wink 1')
        if (max < 400 and self.blink_start != 0):
            self.blink_start = 0
            #print('Wink 0')
            return 1
Exemple #10
0
class Wink:

    talk = Talk()

    def __init__(self):
        self.blink_start = 0
        self.t1 = 0
        self.t2 = 0

    def detectWink(self, max):
        if (max > 400 and self.blink_start == 0):
            self.blink_start = 1
        if (max < 400 and self.blink_start != 0):
            self.blink_start = 0
            return 1
        #     if(self.t1 == 0 and self.t2 == 0 ):
        #         self.t1 = time.time()
        #     elif(self.t2 == 0):
        #         self.t2 = time.time()
        #         delta = self.t2 - self.t1
        #         if( delta > 5 ):
        #             print "yes"
        #             self.t1 = self.t2
        #             self.t2 = 0
        #             self.talk.sayYes()
        #         else:
        #             print "no"
        #             self.t1 = self.t2 = 0
        #             self.talk.sayNo()
        #
        # if(self.t1 > 0 and self.t2 == 0 and time.time() - self.t1 > 5 ):
        #     print "yes"
        #     self.talk.sayYes()
        #     self.t1 = self.t2 = 0
        #     self.talk.sayYes()

#       print max
# time.sleep(1)
# engine.runAndWait()
# time.sleep(1)
import Syna_blink, Syna_states
from Talk import Talk
import pyttsx
import array
import time
import os  #for e-speak

conn = NeuroskyConnector()
socket = conn.getConnectionInstance()
recorder = TimeSeriesRecorder()
parser = ThinkGearParser(recorders=[recorder])
ser = serial.Serial('/dev/ttyACM0', 9600)

w = Syna_blink.Wink()
s = Syna_states.States()
t = Talk()

msg_array = []
wrd_array = []

list_counter = 0
msg_counter = 0
wrd_counter = 0
dash = '-'
dot = '.'

dot_counter = 0
dash_counter = 0
nb_counter = 0

Exemple #12
0
from connector.NeuroskyConnector import NeuroskyConnector
from bluetooth.btcommon import BluetoothError
from neurosky.parser import ThinkGearParser, TimeSeriesRecorder
import wink, states
from Talk import Talk
import sys
from nnet.A4NN import A4NN

conn = NeuroskyConnector()
socket = conn.getConnectionInstance()
recorder = TimeSeriesRecorder()
parser = ThinkGearParser(recorders=[recorder])

w = wink.Wink()
s = states.States()
t = Talk()
net = A4NN()
net.train()
test_dataset = [
    87, 87, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 107, 107, 107, 107, 107,
    107, 167, 247, 55, 29, 59, 59, 29, 29, 29, 129, 129, 129, 129, 307, 309,
    92, 37, 60, 72, 75, 97
]
result = net.predict(test_dataset)
print("test-set validation.  Expected: ~0 - Result:" + repr(result))

test_dataset = [
    85, 85, 85, 85, 85, 85, 85, 85, 85, 72, 72, 72, 97, 149, 337, 436, 436,
    436, 436, 436, 436, 436, 436, 436, 436, 401, 295, 55, 55, 55, 55, 65, 121,
    141, 141, 141, 141, 141, 141
]
canvas.pack()

frame = tk.Frame(root, bg='#d6d6d6')
frame.place(relwidth=1, relheight=1)

label = tk.Label(frame, text="IM Chat 2020 by Erik, Lily, Danny")
label.place(relwidth=0.5, relheight=0.05, relx=0.25, rely=0.1)

messageBox = tk.Message(frame, bg='white', width=425)
messageBox.place(relwidth=0.85, relheight=0.5, relx=0.075, rely=0.175)

textEntry = tk.Entry(frame, text='Enter text...')
textEntry.place(relwidth=0.85, relheigh=0.1, relx=0.075, rely=0.7)

endChatButton = tk.Button(root, text="End Chat", command=endChat)
endChatButton.place(relwidth=0.2, relheigh=0.1, relx=0.075, rely=0.83)

sendButton = tk.Button(root,
                       text="Send",
                       command=lambda: send(name, textEntry.get()))
sendButton.place(relwidth=0.2, relheigh=0.1, relx=0.725, rely=0.83)

talk1 = Talk(ServerIP, ServerPort, OwnPort, on_notify)

talk1.run()

#register event handler for the event you are raising in Talk
#messageBox.bind('SendText', textEntry.get())

root.mainloop()
Exemple #14
0
def main():
    path, send_to_electron = sys.argv[1], Talk(1)
    data = get_training_image(path)
    # send to electron app
    send_to_electron.send(str(data))
    send_to_electron.close()
Exemple #15
0
from bluetooth.btcommon import BluetoothError
from neurosky.parser import  ThinkGearParser, TimeSeriesRecorder
import wink, states
from Talk import Talk
import sys
from nnet.A4NN import A4NN

conn = NeuroskyConnector()
socket = conn.getConnectionInstance()
recorder = TimeSeriesRecorder()
parser = ThinkGearParser(recorders= [recorder])


w = wink.Wink()
s = states.States()
t = Talk()
net = A4NN()
net.train()
test_dataset=[87,87,97,97,97,97,97,97,97,97,97,97,107,107,107,107,107,107,167,247,55,29,59,59,29,29,29,129,129,129,129,307,309,92,37,60,72,75,97]
result = net.predict(test_dataset)
print("test-set validation.  Expected: ~0 - Result:" + repr(result))

test_dataset=[85,85,85,85,85,85,85,85,85,72,72,72,97,149,337,436,436,436,436,436,436,436,436,436,436,401,295,55,55,55,55,65,121,141,141,141,141,141,141]
result = net.predict(test_dataset)
print("test-set validation.  Expected: ~1 - Result:" + repr(result))
i=0
myList=[]
while socket is not None:
    try:
        data = socket.recv(1000)
        parser.feed(data)
Exemple #16
0
frame = tk.Frame(root, bg='#d6d6d6')
frame.place(relwidth=1, relheight=1)

label = tk.Label(frame, text="IM Chat 2020 by Erik, Lily, Danny")
label.place(relwidth=0.5, relheight=0.05, relx=0.25, rely=0.1)

messageBox = tk.Message(frame, bg='white', width=425)
messageBox.place(relwidth=0.85, relheight=0.5, relx=0.075, rely=0.175)

textEntry = tk.Entry(frame, text='Enter text...')
textEntry.place(relwidth=0.85, relheigh=0.1, relx=0.075, rely=0.7)

endChatButton = tk.Button(root, text="End Chat", command=endChat)
endChatButton.place(relwidth=0.2, relheigh=0.1, relx=0.075, rely=0.83)

sendButton = tk.Button(root,
                       text="Send",
                       command=lambda: send(textEntry.get()))
sendButton.place(relwidth=0.2, relheigh=0.1, relx=0.725, rely=0.83)

talk1 = Talk(ServerIP, ServerPort, OwnPort)

talk1.do_something(on_notify)
talk1.run()

#register event handler for the event you are raising in Talk
#messageBox.bind('SendText', textEntry.get())

root.mainloop()