Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,102 @@ from io import StringIO
|
|
15 |
# Configuration
|
16 |
st.set_page_config(page_title="Data Wizard Pro", layout="wide", page_icon="🧙")
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Cache decorators
|
19 |
@st.cache_data(ttl=3600)
|
20 |
def load_data(uploaded_file):
|
@@ -113,6 +209,12 @@ elif app_mode == "Smart Cleaning":
|
|
113 |
df = df.fillna(df.mean())
|
114 |
else:
|
115 |
df = df.dropna()
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
st.session_state.cleaned_data = df
|
118 |
st.success("Transformation applied!")
|
@@ -146,7 +248,7 @@ elif app_mode == "Advanced EDA":
|
|
146 |
with cols[0]:
|
147 |
x_col = st.selectbox("X Axis", df.columns)
|
148 |
with cols[1]:
|
149 |
-
y_col = st.selectbox("Y Axis", df.columns) if plot_type in ["Scatter", "Box"] else None
|
150 |
with cols[2]:
|
151 |
z_col = st.selectbox("Z Axis", df.columns) if plot_type == "3D Scatter" else None
|
152 |
|
@@ -161,6 +263,8 @@ elif app_mode == "Advanced EDA":
|
|
161 |
elif plot_type == "Correlation Heatmap":
|
162 |
corr = df.corr()
|
163 |
fig = px.imshow(corr, text_auto=True, color_continuous_scale='Viridis')
|
|
|
|
|
164 |
|
165 |
st.plotly_chart(fig, use_container_width=True)
|
166 |
|
@@ -176,9 +280,7 @@ elif app_mode == "Model Training":
|
|
176 |
with col1:
|
177 |
model_type = st.selectbox("Choose Model", [
|
178 |
"Linear Regression",
|
179 |
-
"Decision Tree"
|
180 |
-
"Random Forest",
|
181 |
-
"XGBoost"
|
182 |
])
|
183 |
|
184 |
test_size = st.slider("Test Size", 0.1, 0.5, 0.2)
|
@@ -259,4 +361,14 @@ elif app_mode == "Visualization Lab":
|
|
259 |
elif viz_type == "Interactive Heatmap":
|
260 |
corr = df.corr()
|
261 |
fig = px.imshow(corr, text_auto=True, color_continuous_scale='RdBu')
|
262 |
-
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Configuration
|
16 |
st.set_page_config(page_title="Data Wizard Pro", layout="wide", page_icon="🧙")
|
17 |
|
18 |
+
# --- Custom CSS for Futuristic Theme ---
|
19 |
+
st.markdown(
|
20 |
+
"""
|
21 |
+
<style>
|
22 |
+
body {
|
23 |
+
background-color: #0a0a1a; /* Dark background */
|
24 |
+
color: #e0e0ff; /* Light text */
|
25 |
+
font-family: 'Courier New', monospace; /* Monospace font */
|
26 |
+
}
|
27 |
+
.st-emotion-cache-16idsys {
|
28 |
+
background-color: #1e1e30; /* Darker shades for elements */
|
29 |
+
border-radius: 10px; /* Rounded corners */
|
30 |
+
padding: 1rem;
|
31 |
+
margin-bottom: 1rem;
|
32 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Enhanced shadow */
|
33 |
+
}
|
34 |
+
.st-emotion-cache-1v0mbdj {
|
35 |
+
background-color: #1e1e30; /* Darker shades for elements */
|
36 |
+
border-radius: 10px; /* Rounded corners */
|
37 |
+
padding: 1rem;
|
38 |
+
margin-bottom: 1rem;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Enhanced shadow */
|
40 |
+
}
|
41 |
+
.st-emotion-cache-1wrcr25 {
|
42 |
+
background-color: #1e1e30; /* Darker shades for elements */
|
43 |
+
border-radius: 10px; /* Rounded corners */
|
44 |
+
padding: 1rem;
|
45 |
+
margin-bottom: 1rem;
|
46 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Enhanced shadow */
|
47 |
+
}
|
48 |
+
.st-emotion-cache-607q0z, .st-emotion-cache-1v0mbdj, .st-emotion-cache-1v3fvcr, .st-emotion-cache-16idsys{
|
49 |
+
background-color: #1e1e30 !important; /* Darker shades for elements */
|
50 |
+
border-radius: 10px; /* Rounded corners */
|
51 |
+
padding: 1rem !important;
|
52 |
+
margin-bottom: 1rem;
|
53 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Enhanced shadow */
|
54 |
+
color: #e0e0ff !important;
|
55 |
+
}
|
56 |
+
|
57 |
+
.st-bb { /* Sidebar */
|
58 |
+
background-color: #141422; /* Dark sidebar background */
|
59 |
+
padding: 20px;
|
60 |
+
border-radius: 10px;
|
61 |
+
}
|
62 |
+
h1, h2, h3, h4, h5, h6, .st-bb {
|
63 |
+
color: #00f7ff; /* Cyan color for headers */
|
64 |
+
}
|
65 |
+
.st-cb, .st-ci, .st-cj, .st-ch { /* Selectbox and Buttons*/
|
66 |
+
background-color: #141422; /* Dark selectbox background */
|
67 |
+
color: #00f7ff !important; /* Cyan text color */
|
68 |
+
border: 1px solid #00f7ff; /* Cyan border */
|
69 |
+
}
|
70 |
+
.st-cv { /* Selectbox text */
|
71 |
+
color: #00f7ff !important; /* Cyan color for headers */
|
72 |
+
}
|
73 |
+
|
74 |
+
.st-cr { /* number input and text input*/
|
75 |
+
background-color: #141422 !important; /* Dark selectbox background */
|
76 |
+
color: #00f7ff !important; /* Cyan text color */
|
77 |
+
border: 1px solid #00f7ff !important; /* Cyan border */
|
78 |
+
}
|
79 |
+
|
80 |
+
.st-cw { /* Slider */
|
81 |
+
background-color: #141422 !important; /* Dark selectbox background */
|
82 |
+
border: 1px solid #00f7ff !important; /* Cyan border */
|
83 |
+
}
|
84 |
+
|
85 |
+
.st-bz, .st-b0{ /* Buttons*/
|
86 |
+
background-color: #141422; /* Darker Button background */
|
87 |
+
color: #00f7ff; /* Cyan text color */
|
88 |
+
border: 1px solid #00f7ff; /* Cyan border */
|
89 |
+
transition: all 0.3s ease; /* Smooth transition */
|
90 |
+
}
|
91 |
+
.st-bz:hover, .st-b0:hover {
|
92 |
+
background-color: #00f7ff; /* Hover color */
|
93 |
+
color: #0a0a1a; /* Hover text color */
|
94 |
+
}
|
95 |
+
.st-ae { /* File uploader*/
|
96 |
+
background-color: #141422 !important; /* Dark selectbox background */
|
97 |
+
color: #00f7ff !important; /* Cyan text color */
|
98 |
+
border: 1px solid #00f7ff !important; /* Cyan border */
|
99 |
+
border-radius: 10px; /* Rounded corners */
|
100 |
+
}
|
101 |
+
.st-emotion-cache-10trblm { /* Metrics*/
|
102 |
+
background-color: #1e1e30 !important; /* Darker shades for elements */
|
103 |
+
border-radius: 10px !important; /* Rounded corners */
|
104 |
+
padding: 1rem !important;
|
105 |
+
margin-bottom: 1rem !important;
|
106 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5) !important; /* Enhanced shadow */
|
107 |
+
}
|
108 |
+
/* Add more styling for other elements as needed */
|
109 |
+
</style>
|
110 |
+
""",
|
111 |
+
unsafe_allow_html=True,
|
112 |
+
)
|
113 |
+
|
114 |
# Cache decorators
|
115 |
@st.cache_data(ttl=3600)
|
116 |
def load_data(uploaded_file):
|
|
|
209 |
df = df.fillna(df.mean())
|
210 |
else:
|
211 |
df = df.dropna()
|
212 |
+
elif clean_action == "Remove Duplicates":
|
213 |
+
df = df.drop_duplicates()
|
214 |
+
elif clean_action == "Normalize Data":
|
215 |
+
scaler = RobustScaler()
|
216 |
+
numerical_cols = df.select_dtypes(include=np.number).columns
|
217 |
+
df[numerical_cols] = scaler.fit_transform(df[numerical_cols])
|
218 |
|
219 |
st.session_state.cleaned_data = df
|
220 |
st.success("Transformation applied!")
|
|
|
248 |
with cols[0]:
|
249 |
x_col = st.selectbox("X Axis", df.columns)
|
250 |
with cols[1]:
|
251 |
+
y_col = st.selectbox("Y Axis", df.columns) if plot_type in ["Scatter Plot", "Box Plot"] else None
|
252 |
with cols[2]:
|
253 |
z_col = st.selectbox("Z Axis", df.columns) if plot_type == "3D Scatter" else None
|
254 |
|
|
|
263 |
elif plot_type == "Correlation Heatmap":
|
264 |
corr = df.corr()
|
265 |
fig = px.imshow(corr, text_auto=True, color_continuous_scale='Viridis')
|
266 |
+
elif plot_type == "Box Plot":
|
267 |
+
fig = px.box(df,x=x_col, y=y_col, color_discrete_sequence=['#00f7ff'])
|
268 |
|
269 |
st.plotly_chart(fig, use_container_width=True)
|
270 |
|
|
|
280 |
with col1:
|
281 |
model_type = st.selectbox("Choose Model", [
|
282 |
"Linear Regression",
|
283 |
+
"Decision Tree"
|
|
|
|
|
284 |
])
|
285 |
|
286 |
test_size = st.slider("Test Size", 0.1, 0.5, 0.2)
|
|
|
361 |
elif viz_type == "Interactive Heatmap":
|
362 |
corr = df.corr()
|
363 |
fig = px.imshow(corr, text_auto=True, color_continuous_scale='RdBu')
|
364 |
+
st.plotly_chart(fig, use_container_width=True)
|
365 |
+
|
366 |
+
elif viz_type == "Time Series Analysis":
|
367 |
+
# Basic time series plot
|
368 |
+
time_col = st.selectbox("Time Column", df.columns)
|
369 |
+
value_col = st.selectbox("Value Column", df.columns)
|
370 |
+
fig = px.line(df, x=time_col, y=value_col)
|
371 |
+
st.plotly_chart(fig, use_container_width=True)
|
372 |
+
|
373 |
+
elif viz_type == "Cluster Analysis":
|
374 |
+
st.write("Cluster Analysis Feature Coming Soon!") # placeholder for future development
|