LuckyHappyFish commited on
Commit
b6dc022
·
1 Parent(s): 2759f88

initial commit

Browse files
Files changed (1) hide show
  1. app.py +66 -86
app.py CHANGED
@@ -18,7 +18,8 @@ if 'mode' not in st.session_state:
18
  st.session_state['mode'] = 'Light Mode'
19
 
20
  # Light/Dark mode toggle
21
- mode = st.sidebar.selectbox('Select Mode', options=['Light Mode', 'Dark Mode'], index=0 if st.session_state['mode'] == 'Light Mode' else 1)
 
22
 
23
  st.session_state['mode'] = mode
24
 
@@ -28,96 +29,85 @@ def local_css(mode='Light Mode'):
28
  css_string = '''
29
  <style>
30
  /* Light mode CSS */
31
- /* Main layout */
32
- .main {
33
  background-color: #f0f2f6;
 
34
  }
35
  /* Title styling */
36
  .title h1 {
37
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
38
  text-align: center;
39
- color: #000000; /* Black color */
40
  font-size: 3rem;
41
  margin-bottom: 20px;
42
  }
43
  /* Image styling */
44
- .st-image img {
45
  border-radius: 15px;
46
  margin-bottom: 20px;
47
  max-width: 100%;
48
  }
49
  /* Sidebar styling */
50
  [data-testid="stSidebar"] {
51
- background-color: #ffffff; /* White color */
52
- }
53
- [data-testid="stSidebar"] .css-ng1t4o {
54
- color: #000000; /* Black color */
55
- }
56
- [data-testid="stSidebar"] .css-1d391kg {
57
- color: #000000; /* Black color */
58
  }
59
  /* File uploader styling */
60
  .stFileUploader {
61
- border: 2px dashed #000000; /* Black color */
62
  border-radius: 10px;
63
  padding: 20px;
64
  text-align: center;
65
- color: #000000; /* Black color */
66
- background-color: #ffffff; /* White background */
67
  font-weight: bold;
68
  }
69
- /* File uploader hover effect */
70
  .stFileUploader:hover {
71
  background-color: #e0e0e0;
72
  }
73
  /* Button styling */
74
- .stButton>button {
75
- background-color: #000000; /* Black background */
76
- color: #ffffff; /* White text */
77
- border: none;
78
- padding: 0.7rem 1.5rem;
79
- border-radius: 5px;
80
- font-size: 1.1rem;
81
- font-weight: bold;
82
- margin-top: 10px;
83
- }
84
- .stButton>button:hover {
85
- background-color: #333333; /* Darker black */
86
- color: #ffffff;
87
  }
88
  /* Headers styling */
89
- h2 {
90
- color: #000000; /* Black color */
91
- margin-top: 30px;
92
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
93
- }
94
- h3 {
95
- color: #000000; /* Black color */
96
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
97
  }
98
  /* Text styling */
99
- .stMarkdown p {
100
  font-size: 1.1rem;
101
  color: #000000;
102
  }
103
- /* Footer styling */
104
  footer {
105
  visibility: hidden;
106
  }
107
- /* Hide sidebar on small screens */
108
  @media only screen and (max-width: 600px) {
109
  [data-testid="stSidebar"] {
110
  display: none;
111
  }
112
- .main .block-container {
113
  padding-left: 1rem;
114
  padding-right: 1rem;
115
  }
116
  .title h1 {
117
  font-size: 2rem;
118
  }
119
- .stButton>button {
120
- width: 100%;
121
  }
122
  }
123
  /* Sample images grid */
@@ -136,7 +126,7 @@ def local_css(mode='Light Mode'):
136
  border: 2px solid transparent;
137
  }
138
  .sample-images img:hover {
139
- border: 2px solid #000000; /* Black border on hover */
140
  }
141
  </style>
142
  '''
@@ -144,96 +134,85 @@ def local_css(mode='Light Mode'):
144
  css_string = '''
145
  <style>
146
  /* Dark mode CSS */
147
- /* Main layout */
148
- .main {
149
  background-color: #1e1e1e;
 
150
  }
151
  /* Title styling */
152
  .title h1 {
153
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
154
  text-align: center;
155
- color: #ffffff; /* White color */
156
  font-size: 3rem;
157
  margin-bottom: 20px;
158
  }
159
  /* Image styling */
160
- .st-image img {
161
  border-radius: 15px;
162
  margin-bottom: 20px;
163
  max-width: 100%;
164
  }
165
  /* Sidebar styling */
166
  [data-testid="stSidebar"] {
167
- background-color: #333333; /* Dark gray */
168
- }
169
- [data-testid="stSidebar"] .css-ng1t4o {
170
- color: #ffffff; /* White color */
171
- }
172
- [data-testid="stSidebar"] .css-1d391kg {
173
- color: #ffffff; /* White color */
174
  }
175
  /* File uploader styling */
176
  .stFileUploader {
177
- border: 2px dashed #ffffff; /* White color */
178
  border-radius: 10px;
179
  padding: 20px;
180
  text-align: center;
181
- color: #ffffff; /* White color */
182
- background-color: #1e1e1e; /* Dark background */
183
  font-weight: bold;
184
  }
185
- /* File uploader hover effect */
186
  .stFileUploader:hover {
187
  background-color: #333333;
188
  }
189
  /* Button styling */
190
- .stButton>button {
191
- background-color: #ffffff; /* White background */
192
- color: #000000; /* Black text */
193
- border: none;
194
- padding: 0.7rem 1.5rem;
195
- border-radius: 5px;
196
- font-size: 1.1rem;
197
- font-weight: bold;
198
- margin-top: 10px;
199
- }
200
- .stButton>button:hover {
201
- background-color: #e0e0e0; /* Lighter gray */
202
- color: #000000;
203
  }
204
  /* Headers styling */
205
- h2 {
206
- color: #ffffff; /* White color */
207
- margin-top: 30px;
208
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
209
- }
210
- h3 {
211
- color: #ffffff; /* White color */
212
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
213
  }
214
  /* Text styling */
215
- .stMarkdown p {
216
  font-size: 1.1rem;
217
- color: #ffffff; /* White text */
218
  }
219
- /* Footer styling */
220
  footer {
221
  visibility: hidden;
222
  }
223
- /* Hide sidebar on small screens */
224
  @media only screen and (max-width: 600px) {
225
  [data-testid="stSidebar"] {
226
  display: none;
227
  }
228
- .main .block-container {
229
  padding-left: 1rem;
230
  padding-right: 1rem;
231
  }
232
  .title h1 {
233
  font-size: 2rem;
234
  }
235
- .stButton>button {
236
- width: 100%;
237
  }
238
  }
239
  /* Sample images grid */
@@ -252,12 +231,13 @@ def local_css(mode='Light Mode'):
252
  border: 2px solid transparent;
253
  }
254
  .sample-images img:hover {
255
- border: 2px solid #ffffff; /* White border on hover */
256
  }
257
  </style>
258
  '''
259
  st.markdown(css_string, unsafe_allow_html=True)
260
 
 
261
  local_css(st.session_state['mode'])
262
 
263
  # Load the image classification pipeline
 
18
  st.session_state['mode'] = 'Light Mode'
19
 
20
  # Light/Dark mode toggle
21
+ mode = st.sidebar.selectbox('Select Mode', options=['Light Mode', 'Dark Mode'],
22
+ index=0 if st.session_state['mode'] == 'Light Mode' else 1)
23
 
24
  st.session_state['mode'] = mode
25
 
 
29
  css_string = '''
30
  <style>
31
  /* Light mode CSS */
32
+ body {
 
33
  background-color: #f0f2f6;
34
+ color: #000000;
35
  }
36
  /* Title styling */
37
  .title h1 {
38
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
39
  text-align: center;
40
+ color: #000000;
41
  font-size: 3rem;
42
  margin-bottom: 20px;
43
  }
44
  /* Image styling */
45
+ img {
46
  border-radius: 15px;
47
  margin-bottom: 20px;
48
  max-width: 100%;
49
  }
50
  /* Sidebar styling */
51
  [data-testid="stSidebar"] {
52
+ background-color: #ffffff;
53
+ color: #000000;
 
 
 
 
 
54
  }
55
  /* File uploader styling */
56
  .stFileUploader {
57
+ border: 2px dashed #000000;
58
  border-radius: 10px;
59
  padding: 20px;
60
  text-align: center;
61
+ color: #000000;
62
+ background-color: #ffffff;
63
  font-weight: bold;
64
  }
 
65
  .stFileUploader:hover {
66
  background-color: #e0e0e0;
67
  }
68
  /* Button styling */
69
+ button {
70
+ background-color: #000000 !important;
71
+ color: #ffffff !important;
72
+ border: none !important;
73
+ padding: 0.7rem 1.5rem !important;
74
+ border-radius: 5px !important;
75
+ font-size: 1.1rem !important;
76
+ font-weight: bold !important;
77
+ margin-top: 10px !important;
78
+ }
79
+ button:hover {
80
+ background-color: #333333 !important;
81
+ color: #ffffff !important;
82
  }
83
  /* Headers styling */
84
+ h2, h3 {
85
+ color: #000000;
 
 
 
 
 
86
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
87
  }
88
  /* Text styling */
89
+ p {
90
  font-size: 1.1rem;
91
  color: #000000;
92
  }
93
+ /* Hide footer */
94
  footer {
95
  visibility: hidden;
96
  }
97
+ /* Responsive Design */
98
  @media only screen and (max-width: 600px) {
99
  [data-testid="stSidebar"] {
100
  display: none;
101
  }
102
+ .block-container {
103
  padding-left: 1rem;
104
  padding-right: 1rem;
105
  }
106
  .title h1 {
107
  font-size: 2rem;
108
  }
109
+ button {
110
+ width: 100% !important;
111
  }
112
  }
113
  /* Sample images grid */
 
126
  border: 2px solid transparent;
127
  }
128
  .sample-images img:hover {
129
+ border: 2px solid #000000;
130
  }
131
  </style>
132
  '''
 
134
  css_string = '''
135
  <style>
136
  /* Dark mode CSS */
137
+ body {
 
138
  background-color: #1e1e1e;
139
+ color: #ffffff;
140
  }
141
  /* Title styling */
142
  .title h1 {
143
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
144
  text-align: center;
145
+ color: #ffffff;
146
  font-size: 3rem;
147
  margin-bottom: 20px;
148
  }
149
  /* Image styling */
150
+ img {
151
  border-radius: 15px;
152
  margin-bottom: 20px;
153
  max-width: 100%;
154
  }
155
  /* Sidebar styling */
156
  [data-testid="stSidebar"] {
157
+ background-color: #333333;
158
+ color: #ffffff;
 
 
 
 
 
159
  }
160
  /* File uploader styling */
161
  .stFileUploader {
162
+ border: 2px dashed #ffffff;
163
  border-radius: 10px;
164
  padding: 20px;
165
  text-align: center;
166
+ color: #ffffff;
167
+ background-color: #1e1e1e;
168
  font-weight: bold;
169
  }
 
170
  .stFileUploader:hover {
171
  background-color: #333333;
172
  }
173
  /* Button styling */
174
+ button {
175
+ background-color: #ffffff !important;
176
+ color: #000000 !important;
177
+ border: none !important;
178
+ padding: 0.7rem 1.5rem !important;
179
+ border-radius: 5px !important;
180
+ font-size: 1.1rem !important;
181
+ font-weight: bold !important;
182
+ margin-top: 10px !important;
183
+ }
184
+ button:hover {
185
+ background-color: #e0e0e0 !important;
186
+ color: #000000 !important;
187
  }
188
  /* Headers styling */
189
+ h2, h3 {
190
+ color: #ffffff;
 
 
 
 
 
191
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
192
  }
193
  /* Text styling */
194
+ p {
195
  font-size: 1.1rem;
196
+ color: #ffffff;
197
  }
198
+ /* Hide footer */
199
  footer {
200
  visibility: hidden;
201
  }
202
+ /* Responsive Design */
203
  @media only screen and (max-width: 600px) {
204
  [data-testid="stSidebar"] {
205
  display: none;
206
  }
207
+ .block-container {
208
  padding-left: 1rem;
209
  padding-right: 1rem;
210
  }
211
  .title h1 {
212
  font-size: 2rem;
213
  }
214
+ button {
215
+ width: 100% !important;
216
  }
217
  }
218
  /* Sample images grid */
 
231
  border: 2px solid transparent;
232
  }
233
  .sample-images img:hover {
234
+ border: 2px solid #ffffff;
235
  }
236
  </style>
237
  '''
238
  st.markdown(css_string, unsafe_allow_html=True)
239
 
240
+ # Apply the custom CSS based on the selected mode
241
  local_css(st.session_state['mode'])
242
 
243
  # Load the image classification pipeline