File size: 4,460 Bytes
7d90c3e
cb8bc34
 
611bacb
 
c5c9a6a
7d90c3e
 
c5c9a6a
7d90c3e
13f378f
15017bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d90c3e
cb8bc34
 
 
 
 
 
7d90c3e
cb8bc34
 
 
7d90c3e
 
c5c9a6a
 
 
 
 
 
7d90c3e
 
3b2cf4f
cb8bc34
 
c5c9a6a
7d90c3e
 
cb8bc34
 
 
 
48962d5
cb8bc34
1567e3e
f600636
 
94a9e10
d33c021
 
 
 
cb8bc34
 
 
 
 
d92317b
a95cd1c
b2c6819
d92317b
 
 
 
 
ca02d73
1df085b
d92317b
 
b2c6819
 
 
 
 
 
 
 
 
 
 
 
 
f865279
b2c6819
13f378f
f865279
b2c6819
d92317b
 
 
 
ca02d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00143e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import os
import pandas as pd
import streamlit as st
from io import StringIO
import sys

# Define a persistent file path for the dataset
DATA_FILE_PATH = "dataset.csv"

# Page Title
st.markdown("<h1 style='text-align:center; color:#FFD700;'>Hotel Data Set</h1>", unsafe_allow_html=True)
# CSS styles
st.markdown(
    """
    <style>
    body {
        background-color: black; /* Set background color to black */
    }
    .header {
        color: #FFD700; /* Gold for the header */
        font-size: 48px; /* Larger font size for the header */
        font-weight: bold;
        text-align: center; /* Center-align the header */
    }
    .subheader {
        color: #D3D3D3; /* Light Gray for the subheader */
        font-size: 32px; /* Slightly smaller font size for the subheader */
        font-weight: normal;
        text-align: center; /* Center-align the subheader */
    }
    </style>
    """,
    unsafe_allow_html=True,
)


# Function to load the dataset
def load_dataset():
    if os.path.exists(DATA_FILE_PATH):
        return pd.read_csv(DATA_FILE_PATH)
    else:
        return None

# Check if dataset is in session state or load it from disk
if "dataset" not in st.session_state:
    st.session_state["dataset"] = load_dataset()

# File uploader widget to upload a new dataset
uploaded_file = st.file_uploader("Choose a CSV file", type=["csv"])

if uploaded_file is not None:
    # Read the uploaded CSV file into a pandas DataFrame
    df = pd.read_csv(uploaded_file)

    # Save the dataset permanently to disk
    df.to_csv(DATA_FILE_PATH, index=False)

    # Store in session state
    st.session_state["dataset"] = df

    # Display success message
    st.success(f"Dataset uploaded and saved permanently as {DATA_FILE_PATH}!")

# Access the dataset from session state
df = st.session_state.get("dataset")

if df is not None:
    st.subheader("Dataset Preview:")
    st.write(df)  # Display the first 5 rows
    # Redirect the output of df.info() to a string buffer
    buffer = StringIO()
    df.info(buf=buffer)

    # Display the content in Streamlit as Markdown
    st.subheader("Info of the Dataset:")
    st.markdown(f"```{buffer.getvalue()}```")

    st.subheader("Dataset Shape (Rows, Columns):")
    st.write(df.shape)
else:
    st.info("No dataset found. Please upload a CSV file.")
# Define the URL of the background image (use your own image URL)
background_image_url = "https://cdn-uploads.huggingface.co/production/uploads/675fab3a2d0851e23d23cad3/vulm4WwHmmA14tsVXYaTM.jpeg"
# Apply custom CSS for the background image and overlay
st.markdown(
    f"""
    <style>
        .stApp {{
            background-image: url("{background_image_url}");
            background-size: auto;
            background-position: repeat;
            height: 100vh;
        }}
        
        /* Semi-transparent overlay */
        .stApp::before {{
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);  /* Adjust transparency here (0.4 for 40% transparency) */
            z-index: -1;
        }}

         /* Styling the content to ensure text visibility */
        .stMarkdown {{
            color: white;  /* White text to ensure visibility */
            font-size: 30px;  /* Adjust font size for better readability */
        }}
    </style>
    """, 
    unsafe_allow_html=True
)
st.markdown(
    """
    <style>
    .custom-button {
        display: inline-block;
        padding: 5px 10px;
        font-size: 14px;
        color: #ffffff;
        background-color: #4CAF50;
        border: none;
        border-radius: 5px;
        text-align: center;
        text-decoration: none;
        transition: background-color 0.3s ease, transform 0.2s ease;
        cursor: pointer;
    }
    .custom-button:hover {
        background-color: #45a049;
        transform: scale(1.05);
    }
    .button-container {
        display: flex;
        justify-content: space-between;
        margin-top: 20px;
    }
    </style>
    """,
    unsafe_allow_html=True,
)


# Navigation Buttons
st.markdown(
    """
    <div class="button-container">
        <a href="/0_Problem_Statement" target="_self" class="custom-button">Previous ⏮️</a>
        <a href="/2_Data_Cleaning_and_Processing" target="_self" class="custom-button">Next ⏭️</a>
    </div>
    """,
    unsafe_allow_html=True,
)