App reloads after selecting a differnt option from dropdown meny


I am building an app that read a csv file and take user inputs. then based on the inputs and user click on submit, along with other data output, a dropdown will appear for selecting different graphs. Initially the app creates graph based on default selection of dropdown. but as soon as i select a differnt option from dropdown, the app reloads itself. I tried st.session_state as well. but no help.

below is the code:

# Load CSV
uploaded_file = st.file_uploader("Upload CSV", type=['csv'])
# Load module specifications from CSV
module_df = pd.read_csv('module_data.csv')
# Begin form
with st.form(key='my_form'):
    # Get plant capacity from user
    plant_cap = st.number_input("Enter the plant capacity in kW")
    # User inputs...
    # Every form must have a submit button.
    submitted = st.form_submit_button("Submit")

    month_to_display = st.selectbox("Select a month to display daily energy consumption", energy_df['Month'].unique())

    # Plot for daily max and min demand for selected month
    selected_month = df[df.index.month == pd.to_datetime(month_to_display, format='%B').month]
    daily_max = selected_month['Energy'].resample('D').max()
    daily_min = selected_month['Energy'].resample('D').min()
    fig = go.Figure(data=[
        go.Bar(name='Max Demand', x=daily_max.index, y=daily_max.values),
        go.Bar(name='Min Demand', x=daily_min.index, y=daily_min.values)
    fig.update_layout(barmode='group', title_text='Daily Max and Min Demand for ' + month_to_display)
    st.plotly_chart(fig, use_container_width=True)

This is also happening for some other apps based on same concept.