Spaces:
Runtime error
Runtime error
Update app.py
Browse files22 unmodified lines232425262728293031323334353637383940414222 unmodified lines1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]Q_s = policy_net(to_tensor(sample_state))a_opt = Q_s.max(0)[1].detach()#plt.figure(figsize=(16, 5))#plt.xlabel("Price action ($)")#plt.ylabel("Q ($)")#t.bar_chart(price_grid, Q_s.detach().numpy(), color='crimson', width=6, alpha=0.8)#plt.show()return price_grid[a_opt]def fun():st.header("Optimal Price Action")st.subheader(str(a))returnst.header("Enter the Specification")max_value = st.number_input('Enter the Maximum Value of Price',min_value=50,value = 500,step=1)step = st.number_input('Enter the Price step',min_value = 10,value = 10,step=1)a = prediction(max_value,step,pc2)if st.button('Predict'):fun()22 unmodified lines23242526272829303132333435363738394041424322 unmodified lines1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]Q_s = policy_net(to_tensor(sample_state))a_opt = Q_s.max(0)[1].detach()return price_grid[a_opt],Q_s.detach().numpy()def fun():st.header("Optimal Price Action")st.subheader(str(a))plt.figure(figsize=(16, 5))plt.xlabel("Price action ($)")plt.ylabel("Q ($)")plt.bar_chart(price_grid, Q_s.detach().numpy(), color='crimson', width=6, alpha=0.8)plt.show()returnst.header("Enter the Specification")max_value = st.number_input('Enter the Maximum Value of Price',min_value=50,value = 500,step=1)step = st.number_input('Enter the Price step',min_value = 10,value = 10,step=1)a,b = prediction(max_value,step,pc2)if st.button('Predict'):fun()
app.py+8-7