PygameButton(game_display, right_arm_g, (0, 0, 255), font, " O", (255, 255, 255)) finish_button = PygameButton(game_display, finish_button_position, (255, 0, 0), font, "Finish", (255, 255, 255)) pygame.display.update() crashed = False # directory = max(glob.glob('*'), key=os.path.getctime) # path to last modified folder directory = 'Your model directory name' # hard coded path to trained model with open(directory + '/Data.pickle', 'rb') as handle: rows_per_epoch = pickle.load(handle)['X'].shape[0] with open(directory + '/Model.pickle', 'rb') as handle: clf = pickle.load(handle) # clf.zero_thresh = 0.5 # this classifier parameter can be changed during control stage bci = BCI() prp = BatyaGGPreprocessor(rows_per_epoch) recent_data = prp.fit_test(bci.get_recent_data(rows_per_epoch)) current_class = clf.predict(recent_data) control_updater = ControlUpdater(['x', 'y', 'z', 'g']) current_control = control_updater.get_next() ur = UR() ur.go_home() mixer.music.load('x_axis.mp3') mixer.music.play() while not crashed: if current_class == 3: current_control = control_updater.get_next() if current_control == 'x': mixer.music.load('x_axis.mp3') mixer.music.play() elif current_control == 'y': mixer.music.load('y_axis.mp3')