Task-272 Tested out some of the formatting features with Streamlit
Browse files- research/ui_formatting.py +50 -0
research/ui_formatting.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
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:
|
45 |
+
st.session_state.counter = 0
|
46 |
+
|
47 |
+
st.session_state.counter += 1
|
48 |
+
|
49 |
+
st.header(f"This page has run {st.session_state.counter} times.")
|
50 |
+
st.button("Run it again")
|