diff --git a/app.py b/app.py index 0510bee10f750920df06d788c0c58005402aaebc..6f93737c871fbcc8c7039c22eeb139dce54c70e5 100644 --- a/app.py +++ b/app.py @@ -3,9 +3,9 @@ import streamlit as st import altair as alt import os from sklearn.preprocessing import LabelEncoder -import joblib # For loading Scikit-Learn models +import joblib + -# Load the dataset df = pd.read_csv("FakeDataset.csv") # Load Scikit-Learn models @@ -23,7 +23,7 @@ if not os.path.exists("country_code_encoder.pkl"): country_code_encoder = LabelEncoder() df["Airport Country Code"] = country_code_encoder.fit_transform(df["Airport Country Code"]) - # Save the encoder for future use + joblib.dump(country_code_encoder, "country_code_encoder.pkl") st.success("Country code encoder has been created and saved as 'country_code_encoder.pkl'.") else: @@ -39,7 +39,7 @@ if not os.path.exists("airport_encoder.pkl"): airport_encoder = LabelEncoder() df["Arrival Airport"] = airport_encoder.fit_transform(df["Arrival Airport"]) - # Save the encoder for future use + joblib.dump(airport_encoder, "airport_encoder.pkl") st.success("Airport encoder has been created and saved as 'airport_encoder.pkl'.") else: @@ -48,19 +48,19 @@ else: # Load the encoder if it already exists airport_encoder = joblib.load("airport_encoder.pkl") -# Initialize Streamlit +# Starting Streamlit st.title("Airline Chatbot & Data Explorer with Predictions") # Adding the Bot image st.image("Chatbot_image.gif", caption="Welcome to the Airline Chatbot & Data Explorer!", use_container_width=True) -# Add navigation +# Added navigation menu = st.sidebar.selectbox("Select a Feature", ["Chatbot", "Data Explorer", "Visualizations", "Predictions"]) def show_chatbot_section(): st.subheader("Chat with Airline Assistant") - # Initialize session states for conversation flow + # Initialize different states for conversation flow if "greeted" not in st.session_state: st.session_state.greeted = False if "help_query" not in st.session_state: @@ -98,7 +98,7 @@ def show_chatbot_section(): else: st.info("Let me know how I can assist you further.") - # Passenger ID and Last Name functionality + # Passenger ID and Last Name Input functionality if st.session_state.help_query and not st.session_state.details_fetched: passenger_id = st.text_input("Please enter your Passenger ID:") last_name = st.text_input("Please enter your Last Name:")