Recursion error in ML Model deployed to docker via streamlit

I am getting recursion error when I try to run a ML model-based app on streamlit and docker. It works fine outside docker using streamlit locally. What can be the reason for this?


import streamlit as st
import pandas as pd
import pickle
import numpy as np

mlmodel = pickle.load(open('model.pkl', 'rb'))

def run():
    add_selectbox = st.sidebar.selectbox(
        "How would you like to predict?",
        ("Online", "Batch"))'Enter Flight Detail Below')
    st.title("Flight Delay Prediction App")

    if add_selectbox == 'Online':
        FlightDate = st.date_input("FlightDate")
        DepTime = st.time_input("DepTime")
        UniqueCarrier = st.text_input("UniqueCarrier")
        Origin = st.text_input("Origin")
        Dest = st.text_input("Dest")
        Distance = st.number_input("Distance")
        Day_of_Week = st.text_input("Day_of_Week")
        output = ""
        input_dict = {'FlightDate': FlightDate,
                      'DepTime': DepTime,
                      'UniqueCarrier': UniqueCarrier,
                      'Origin': Origin,
                      'Dest': Dest,
                      'Distance': Distance,
                      'Day_of_Week': Day_of_Week,
        input_df = pd.DataFrame([input_dict])

        if st.button("Predict"):
            pred = mlmodel.predict(X = input_df)
            if pred[0] == 0:
                output = str("The Flight is not Delayed")
                output = str("The Flight is Delayed")


    if add_selectbox == 'Batch':

        file_upload = st.file_uploader("Upload csv file for predictions", type=["csv"])
        if file_upload is not None:
            data = pd.read_csv(file_upload)
            output = mlmodel.predict(X= data)

if __name__ == '__main__':