def _run_app(self): ''' Internal version of run app ''' # suppress output streams sys.stdout = open(os.devnull, 'w') sys.stderr = open(os.devnull, 'w') # Run flask without auto reload run_app(False)
moves.append(Move(0.747, 1.051, -0.005, 4.0)) moves.append(Move(0.748, 1.052, -0.005, 4.0)) moves.append(Move(0.75, 1.054, -0.005, 4.0)) moves.append(Move(0.751, 1.055, -0.005, 4.0)) moves.append(Move(None, None, 0.05, 8)) moves.append(Move(1.089, 1.102, 0.05, 8)) moves.append(Move(None, None, -0.005, 4.0)) moves.append(Move(1.175, 1.102, -0.005, 4.0)) moves.append(Move(1.176, 1.101, -0.005, 4.0)) moves.append(Move(1.178, 1.099, -0.005, 4.0)) moves.append(Move(1.179, 1.095, -0.005, 4.0)) moves.append(Move(1.179, 1.066, -0.005, 4.0)) moves.append(Move(1.178, 1.065, -0.005, 4.0)) moves.append(Move(1.176, 1.063, -0.005, 4.0)) moves.append(Move(1.172, 1.062, -0.005, 4.0)) moves.append(Move(1.089, 1.062, -0.005, 4.0)) moves.append(Move(1.088, 1.063, -0.005, 4.0)) moves.append(Move(1.086, 1.065, -0.005, 4.0)) moves.append(Move(1.085, 1.068, -0.005, 4.0)) moves.append(Move(0.965, 1.068, -0.005, 4.0)) moves.append(Move(0.965, 1.051, -0.005, 4.0)) moves.append(Move(0.968, 1.051, -0.005, 4.0)) moves.append(Move(0.968, 1.053, -0.005, 4.0)) moves.append(Move(0.971, 1.054, -0.005, 4.0)) moves.append(Move(0.972, 1.055, -0.005, 4.0)) moves.append(Move(0.993, 1.055, -0.005, 4.0)) moves.append(Move(0.994, 1.054, -0.005, 4.0)) moves.append(Move(0.996, 1.052, -0.005, 4.0)) moves.append(Move(0.997, 1.048, -0.005, 4.0)) run_app(moves)
"unrolled_gan": False, #Whether or not to use unrolled_gan "unrolling_steps": None, "z_uniform": False, "z_dim": 256, "ali": False, "visualize": True, # "True for visualizing, False for nothing [False]" "eval_infvo_lbfgsb_maxiter": -1, # "UnrolledGAN's Inferene via Optimization evaluation. # maxiter for the l-bfgs-b scipy implementation." "eval_mnist_stacked_examples": 50000 # "number of examples to generate for UGAN's MNIST stacked evalutation" } FLAGS = AttributeDict(flags) FLAGS.main_output_dir = str( "DCGAN/" + flags["dataset"]) + "/ali_dcgan_run" + str(i) FLAGS.sample_dir = FLAGS.main_output_dir + "/samples" FLAGS.checkpoint_dir = FLAGS.main_output_dir + "/checkpoint" # now that settings are configured, run the GAN output_str = run_app(FLAGS) text_file = open(FLAGS.main_output_dir + "/output.txt", "w") text_file.writelines(pp.pformat(FLAGS)) text_file.write("\n") text_file.write("Result: %s" % output_str) text_file.close() tf.reset_default_graph()
from tensorpack.utils.serialize import loads from main import Sphere, build_cylinder_from_3dpts, Frame, run_app if __name__ == '__main__': B = 600.0 drawer = GLDrawer('winname', [(-B, B)] * 3) drawer.start() cnt = 0 ctx = zmq.Context() sok = ctx.socket(zmq.PULL) print 'Starting server at 0.0.0.0:8888 ...' sok.bind('tcp://0.0.0.0:8888') def get_frame(): global cnt cnt += 1 data = loads(sok.recv(copy=False).bytes) data = data * 100 print data spheres = [Sphere(3, pos) for pos in data] spheres[0].radius = 10 cyls = build_cylinder_from_3dpts(data) f = Frame(spheres, cyls) return f run_app(drawer.draw_callback, get_frame) sleep(100)