Why my app just keep running forever without any output even locally

why my streamlit app just keep running forever without any output even locally?

you can restart your app first to see what will happen.
if result is same,
maybe because your data is very big or you used a lot of circle methods in code.

The result is same and there is no circle in my code ,but I insert a lot number_input (about 7 per page).Is it makes my app just keep running forever?Here is part of my code

if page == '所需资源预测':
        st.write('# 所需资源预测')
        st.write('***')        
        column1,column2=st.columns(2)
        with column1:
            st.write('### 输入')
            ExportVolume=st.number_input('出库量',min_value=0,help='请输入一个整数作为出库量')
            ImportVolume=st.number_input('入库量',min_value=0,help='请输入一个整数作为入库量')
            num_of_position=st.number_input('收发货位总数',min_value=1,help='请输入一个整数作为收发货位总数')
            t_in=st.number_input('单箱入库时间(分钟)',min_value=0.0,value=2.0,help='请输入一个浮点数作为单箱入库时间(单个箱头的入库用时)')
            t_out=st.number_input('单箱出库时间(分钟)',min_value=0.0,value=2.0,help='请输入一个浮点数作为单箱出库时间(单个箱头的出库用时)')
            T_Consuming=st.number_input('作业耗时(分钟)',min_value=0.0,help='请输入一个浮点数作为作业耗时')
            num_of_ccs,position_for_export,position_for_import=ResourceRequired(ExportVolume,ImportVolume,num_of_position,t_in,t_out,T_Consuming)
        with column2:
            st.write('### 输出')
            st.metric("所需叉车手",str(num_of_ccs))
            st.metric('所需发货位',str(position_for_export))
            st.metric('所需收货位',str(position_for_import))

check this function, no result because ResourceRequired did not return values.

num_of_ccs,position_for_export,position_for_import=ResourceRequired(ExportVolume,ImportVolume,num_of_position,t_in,t_out,T_Consuming)

Finally,I konw what happend.It is those number_input that make my app keep rerunning.Now I rewrite my code and the problem solved.Thanks for your help and here is part of my new code

if page == '所需资源预测':
        st.write('# 所需资源预测')
        st.write('***')        
        column1,column2=st.columns(2)
        with column1:
            st.write('### 输入')
            ExportVolume=st.number_input('出库量',min_value=0,value=1,help='请输入一个整数作为出库量')
            if not ExportVolume:
                st.stop()    #stop the app to rerun
            ImportVolume=st.number_input('入库量',min_value=0,value=1,help='请输入一个整数作为入库量')
            if not ImportVolume:
                st.stop()
            num_of_position=st.number_input('收发货位总数',min_value=1,value=1,help='请输入一个整数作为收发货位总数')
            if not num_of_position:
                st.stop()
            t_in=st.number_input('单箱入库时间(分钟)',min_value=0.0,value=2.0,help='请输入一个浮点数作为单箱入库时间(单个箱头的入库用时)')
            if not t_in:
                st.stop()
            t_out=st.number_input('单箱出库时间(分钟)',min_value=0.0,value=2.0,help='请输入一个浮点数作为单箱出库时间(单个箱头的出库用时)')
            if not t_out:
                st.stop()
            T_Consuming=st.number_input('作业耗时(分钟)',min_value=0.0,value=60.0,help='请输入一个浮点数作为作业耗时')
            if not T_Consuming:
                st.stop()
            num_of_ccs,position_for_export,position_for_import=ResourceRequired(ExportVolume,ImportVolume,num_of_position,t_in,t_out,T_Consuming)
        with column2:
            st.write('### 输出')
            st.metric("所需叉车手",str(num_of_ccs))
            st.metric('所需发货位',str(position_for_export))
            st.metric('所需收货位',str(position_for_import))

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.