def main():
    parser = argparse.ArgumentParser(description='latent space enjoy')
    parser.add_argument('--log-dir', default='', type=str, help='directory to load model')
    parser.add_argument('-ae', '--ae-path', help='Path to saved AE', type=str, default='')
    args = parser.parse_args()
    autoencoder = Autoencoder.load(args.ae_path)
    fig_name = 'Decoder for the AE'
    bound_min = (- 10)
    bound_max = 10
    create_figure_and_sliders(fig_name, autoencoder.z_size)
    should_exit = False
    while (not should_exit):
        k = (cv2.waitKey(1) & 255)
        if (k == 27):
            break
        state = []
        for i in range(autoencoder.z_size):
            state.append(cv2.getTrackbarPos(str(i), ('slider for ' + fig_name)))
        state = (((np.array(state) / 100) * (bound_max - bound_min)) + bound_min)
        reconstructed_image = autoencoder.decode(state[None])[0]
        if ((cv2.getWindowProperty(fig_name, 0) < 0) or (cv2.getWindowProperty(('slider for ' + fig_name), 0) < 0)):
            should_exit = True
            break
        cv2.imshow(fig_name, reconstructed_image)
    cv2.destroyAllWindows()
def main():
    parser = argparse.ArgumentParser(description='latent space enjoy')
    parser.add_argument('--log-dir', default=, type=str, help='directory to load model')
    parser.add_argument('-ae', '--ae-path', help='Path to saved AE', type=str, default=)
    args = parser.parse_args()
    autoencoder = Autoencoder.load(args.ae_path)
    fig_name = 'Decoder for the AE'
    bound_min = (- 10)
    bound_max = 10
    create_figure_and_sliders(fig_name, autoencoder.z_size)
    should_exit = False
    while (not should_exit):
        k = (cv2.waitKey(1) & 255)
        if (k == 27):
            break
        state = []
        for i in range(autoencoder.z_size):
            state.append(cv2.getTrackbarPos(str(i), ('slider for ' + fig_name)))
        state = (((np.array(state) / 100) * (bound_max - bound_min)) + bound_min)
        reconstructed_image = autoencoder.decode(state[None])[0]
        if ((cv2.getWindowProperty(fig_name, 0) < 0) or (cv2.getWindowProperty(('slider for ' + fig_name), 0) < 0)):
            should_exit = True
            break
        cv2.imshow(fig_name, reconstructed_image)
    cv2.destroyAllWindows()