-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathapp.py
More file actions
146 lines (120 loc) Β· 3.41 KB
/
app.py
File metadata and controls
146 lines (120 loc) Β· 3.41 KB
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
# ==============================
# app.py - AlgoLab Main Script
# ==============================
import streamlit as st
# Internal imports
import model_comparison
from data_handler.upload_validate import upload_and_validate, generate_dataset, toy_dataset
from unsupervised_algorithms.unsupervised_module import unsupervised
from Supervised_algorithms.supervised_module import supervised
# ==============================
# Page configuration
# ==============================
st.set_page_config(
page_title="Algo Lab",
page_icon="π¬",
layout="centered",
initial_sidebar_state="expanded"
)
# ==============================
# App Header
# ==============================
st.title("π¬ AlgoLabs β Visualize and Learn")
st.markdown("""
<div style='padding:12px; border-left:5px solid black;
background-color: rgba(74,144,226,0.1); font-style:italic;'>
"You are the average of the five people you spend time with"<br>
<b>β Jim Rohn</b>
</div>
""", unsafe_allow_html=True)
# ==============================
# Tabs
# ==============================
tab1, tab2, tab3, tab4 = st.tabs([
"π Home",
"π€ Supervised Learning",
"π§ Unsupervised Learning",
"π Model Comparison"
])
# ==============================
# Sidebar β Dataset / Image
# ==============================
with st.sidebar:
st.header("π Dataset Options")
choice = st.radio(
"Choose option:",
["Upload Dataset", "Generate Dataset",],
index=0
)
if choice == "Upload Dataset":
df = upload_and_validate()
if df is not None:
st.session_state.df = df
elif choice == "Generate Dataset":
df = generate_dataset()
if df is not None:
st.session_state.df = df
# ==============================
# π Home
# ==============================
with tab1:
st.subheader("Welcome to AlgoLab π")
if "df" in st.session_state:
st.dataframe(st.session_state.df.head())
else:
st.info("Upload or generate a dataset to begin.")
# ==============================
# π€ Supervised Learning (Streamlit)
# ==============================
with tab2:
st.subheader("Supervised Learning")
if "df" in st.session_state:
st.session_state.uploaded_data = st.session_state.df
supervised()
else:
st.info("Upload a dataset first.")
# ==============================
# π§ Unsupervised Learning
# ==============================
with tab3:
st.subheader("Unsupervised Learning")
if "df" in st.session_state:
st.session_state.uploaded_data = st.session_state.df
unsupervised()
else:
st.info("Upload a dataset first.")
# ==============================
# π Model Comparison
# ==============================
with tab4:
model_comparison.show()
# ==============================
# Footer
# ==============================
st.markdown(
"""
<style>
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: #f0f2f6;
color: black;
text-align: right;
padding: 8px 16px;
font-size: 14px;
z-index: 999;
border-top: 1px solid #e0e0e0;
}
/* Prevent content from being hidden behind footer */
.block-container {
padding-bottom: 60px;
}
</style>
<div class="footer">
Β© 2025 GGSOC β€οΈ
</div>
""",
unsafe_allow_html=True
)