Spaces:
Runtime error
Runtime error
Commit ·
0358ba5
1
Parent(s): 6ce18df
Update app.py
Browse files59 unmodified lines606162636465667 unmodified lines7475767778798059 unmodified linesinfo_text = 'Start point=' + str(start_point) + '\n' +'End point=' + str([x[-1],y[-1]]) + '\n' +'Displacement =' + str(distance_from_start([x[-1], y[-1]], start_point)) + '\n' +'Max x = ' + str(max(x)) + '\n' + 'Min x = ' + str(min(x)) + '\n' + 'Max y = ' + str(max(y)) + '\n' + 'Min y = ' + str(min(y))ax.legend([info_text], loc='best', handlelength=0, handletextpad=0, fancybox=True, fontsize=8)plt.title('2D Random Walk\nsteps=' + str(iters)+', step size='+ str(step_size)+ ', seed = '+str(int(random_seed)))plt.grid()fig.canvas.draw()7 unmodified linesexcept:random_seed = random.randint(1, 1000)if random_seed is None:random_seed = random.randint(1, 1000)iface = gr.Interface(fn=generate_random_walk, inputs=[iters, step_size, random_seed], outputs="image", title="2-D Random Walk Plot", description="Steps along NEWS directions only")59 unmodified lines606162636465667 unmodified lines7475767778798059 unmodified linesinfo_text = 'Start point=' + str(start_point) + '\n' +'End point=' + str([x[-1],y[-1]]) + '\n' +'Displacement =' + str(distance_from_start([x[-1], y[-1]], start_point)) + '\n' +'Max x = ' + str(max(x)) + '\n' + 'Min x = ' + str(min(x)) + '\n' + 'Max y = ' + str(max(y)) + '\n' + 'Min y = ' + str(min(y))ax.legend([info_text], loc='best', handlelength=0, handletextpad=0, fancybox=True, fontsize=8)plt.title( '2D Random Walk\nsteps=' + str(iters)+', step size='+ str(step_size)+ ', seed = '+str(int(random_seed)) )plt.grid()fig.canvas.draw()7 unmodified linesexcept:random_seed = random.randint(1, 1000)if random_seed == None:random_seed = random.randint(1, 1000)iface = gr.Interface(fn=generate_random_walk, inputs=[iters, step_size, random_seed], outputs="image", title="2-D Random Walk Plot", description="Steps along NEWS directions only")
app.py+2-2