Task-272 Uncommented code
Browse files- research/ui_formatting.py +35 -35
research/ui_formatting.py
CHANGED
@@ -4,41 +4,41 @@ import numpy as np
|
|
4 |
import time
|
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 |
## Sessions:
|
44 |
if "counter" not in st.session_state:
|
|
|
4 |
import time
|
5 |
|
6 |
|
7 |
+
## Sidebar Usage:
|
8 |
+
ex_select_box = st.sidebar.selectbox(
|
9 |
+
'Favorite Music Genre:',
|
10 |
+
('Rock', 'Reggae', 'Bluegrass')
|
11 |
+
)
|
12 |
+
|
13 |
+
ex_slider = st.sidebar.slider(
|
14 |
+
'Age Range:',
|
15 |
+
0, 100, (25, 75)
|
16 |
+
)
|
17 |
+
|
18 |
+
## Column Usage:
|
19 |
+
lc, rc = st.columns(2)
|
20 |
+
## Columns like sidebars:
|
21 |
+
lc.button('Example - Left Column Button')
|
22 |
+
|
23 |
+
## Using with blocks:
|
24 |
+
with rc:
|
25 |
+
choice = st.radio(
|
26 |
+
'Favorite Color:',
|
27 |
+
("Red", "Blue", "Green", "Magenta"))
|
28 |
+
st.write(f"{choice} is your favorite color!" if choice != 'Magenta' else f'{choice} is not a natural color!')
|
29 |
+
|
30 |
+
## Progress Bars:
|
31 |
+
'Loading...'
|
32 |
+
|
33 |
+
percentage = st.empty()
|
34 |
+
bar = st.progress(0)
|
35 |
+
|
36 |
+
for i in range(100):
|
37 |
+
# Update the progress bar with each iteration.
|
38 |
+
percentage.text(f'{i+1}%')
|
39 |
+
bar.progress(i + 1)
|
40 |
+
time.sleep(0.1)
|
41 |
+
'Loading complete!'
|
42 |
|
43 |
## Sessions:
|
44 |
if "counter" not in st.session_state:
|