tushar27 commited on
Commit
2482ff6
1 Parent(s): 4ace37d

From github updates

Browse files
.gitattributes DELETED
@@ -1,35 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/.gitkeep ADDED
File without changes
.gitignore ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env/
11
+ .venv
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg'
26
+ venv
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+
48
+ # Translations
49
+ *.mo
50
+ *.pot
51
+
52
+ # Django stuff:
53
+ *.log
54
+
55
+ # Sphinx documentation
56
+ docs/_build/
57
+
58
+ # PyBuilder
59
+ target/
60
+
61
+ # DotEnv configuration
62
+ .env
63
+
64
+ # Database
65
+ *.db
66
+ *.rdb
67
+
68
+ # Pycharm
69
+ .idea
70
+
71
+ # VS Code
72
+ .vscode/
73
+
74
+ # Spyder
75
+ .spyproject/
76
+
77
+ # Jupyter NB Checkpoints
78
+ .ipynb_checkpoints/
79
+
80
+ # Mac OS-specific storage files
81
+ .DS_Store
82
+
83
+ # vim
84
+ *.swp
85
+ *.swo
86
+
87
+ # Caches
88
+ .mypy_cache/
89
+ .pytest_cache/
90
+ .ruff_cache/
91
+
92
+ # Hydra logs
93
+ outputs
94
+ #Manual
95
+ template.py
96
+ templates/
97
+ .streamlit/secrets.toml
98
+ secrets.toml
.streamlit/config.toml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [global]
2
+ # disableWatchdogWarning = true
3
+ [server]
4
+ runOnSave =true
5
+ [browser]
6
+ gatherUsageStats = true
7
+
8
+ [deprecation]
9
+ # showfileUploaderEncoding = false
10
+ # showPyplotGlobalUse =false
11
+ [logger]
12
+ # Default: "%(asctime)s %(message)s"
13
+ # messageFormat = "%(asctime)s %(message)s"
14
+ [theme]
15
+ # Primary accent color for interactive elements.
16
+ primaryColor = "#042940"
17
+ # Background color for the main content area.
18
+ backgroundColor = "#ecebe9"
19
+ # Background color used for the sidebar and most interactive widgets.
20
+ secondaryBackgroundColor = "#ecebe9"
21
+ # Color used for almost all text.
22
+ textColor = "#042940"
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11
2
+
3
+ RUN pip install virtualenv
4
+ ENV VIRTUAL_ENV=/venv
5
+ RUN virtualenv venv -p python3
6
+ ENV PATH="VIRTUAL_ENV/bin:$PATH"
7
+
8
+ WORKDIR /app
9
+ ADD . /app
10
+
11
+ # Install dependencies
12
+ RUN pip install -r requirements.txt
13
+ RUN apt-get update
14
+
15
+ # Expose port
16
+ ENV PORT 8501
17
+
18
+ # Run the application:
19
+ CMD ["streamlit","run","Home.py"]
README.md CHANGED
@@ -1,12 +1,27 @@
1
- ---
2
- title: Streamlit Magic Cheat Sheet
3
- emoji: 🐢
4
- colorFrom: red
5
- colorTo: yellow
6
- sdk: streamlit
7
- sdk_version: 1.28.0
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
 
1
+ # Streamlit Magic Cheat Sheets
2
+ ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)
3
+ ![Streamlit](https://img.shields.io/badge/Streamlit-FF4B4B.svg?style=for-the-badge&logo=Streamlit&logoColor=white)
4
+ ![CSS](https://img.shields.io/badge/CSS3-1572B6.svg?style=for-the-badge&logo=CSS3&logoColor=white)
5
+ ![HTML](https://img.shields.io/badge/HTML5-E34F26.svg?style=for-the-badge&logo=HTML5&logoColor=white)
6
+ ![Markdown](https://img.shields.io/badge/markdown-%23000000.svg?style=for-the-badge&logo=markdown&logoColor=white)
7
+ ![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white)
8
+ ## Deployment [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://st-cheat-sheet.streamlit.app/)
9
+
10
+ `Streamlit Magic Cheat Sheets` encapsulates the Streamlit documentation version 1.28.0, providing concise summaries along with exemplar implementations of Streamlit code snippets.
11
+
12
+ `October, 2023 v1.1.1` - The development and maintenance of this application are solely undertaken by [Tushar Aggarwal](https://www.linkedin.com/in/tusharaggarwalinseec/)
13
+
14
+
15
+ ## Author
16
+ - [<ins><b>©2023 Tushar Aggarwal. All rights reserved</b></ins>](https://www.tushar-aggarwal.com/)
17
+ - <b>[LinkedIn](https://www.linkedin.com/in/tusharaggarwalinseec/)</b>
18
+ - <b>[Medium](https://medium.com/@tushar_aggarwal)</b>
19
+ - <b>[Tushar-Aggarwal.com](https://www.tushar-aggarwal.com/)</b>
20
+ - <b>[X](https://twitter.com/TaggData)</b>
21
+ - <b>[Data Unboxed Newsletter](https://tadata.substack.com/)</b>
22
+ - <b>[HuggingFace](https://huggingface.co/tushar27)</b>
23
+ - <b>[DagsHub](https://dagshub.com/tushar27)</b>
24
+ - <b>[Hashnode](https://hashnode.com/@TAGG)</b>
25
+ - <b>[NovyPro](https://www.novypro.com/profile_projects/tusharagg)</b>
26
+ - <b>[New Kaggle](https://www.kaggle.com/tagg27)</b>
27
 
app.py CHANGED
@@ -1,151 +1,60 @@
1
- #Streamlit Magic Sheets by github.com/2704 & Tushar-Aggarwa.com
2
- import streamlit as st
3
-
4
- st.title("Streamlit Magic Sheets")
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
 
 
 
 
 
 
 
147
 
148
 
 
149
 
150
 
151
 
@@ -156,10 +65,16 @@ st.title("Streamlit Magic Sheets")
156
 
157
 
158
 
 
 
159
 
160
 
 
161
 
 
 
162
 
 
163
 
164
 
165
 
 
1
+ ##© 2023 Tushar Aggarwal. All rights reserved.
2
+ ##Streamlit Magic Cheat Sheets
3
+ #######################################################################################################
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ #######################################################################################################
6
+ #Importind required libraries
7
+ #######################################################################################################
8
 
9
+ import streamlit as st
10
+ from pathlib import Path
11
+ import base64
12
+ import sys
13
+ from pathlib import Path
14
+ script_dir = Path(__file__).resolve().parent
15
+ project_root = script_dir.parent
16
+ sys.path.append(str(project_root))
17
+ import warnings
18
+ warnings.filterwarnings("ignore")
19
+ #######################################################################################################
20
+ #Importing from SRC
21
+ #######################################################################################################
22
+ from src.Streamlit_Magic_Sheet.components.header import *
23
+ from src.Streamlit_Magic_Sheet.components.body import *
24
+ from src.Streamlit_Magic_Sheet.components.navigation import *
25
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
26
+ from src.Streamlit_Magic_Sheet.components.metrics import *
27
+ from src.Streamlit_Magic_Sheet.components.charts import *
28
+ from src.Streamlit_Magic_Sheet.components.test import *
29
+ #######################################################################################################
30
+ #Page Config of Streamlit-Magic-Sheet by github.com/tushar2704
31
+ #######################################################################################################
32
 
33
 
34
+ page_title="Streamlit Magic Cheat Sheets"
35
+ page_icon="🪄"
36
+ layout='wide'
37
 
38
 
39
+ page_config(page_title=page_title,
40
+ page_icon=page_icon,
41
+ layout=layout)
42
 
43
+ #######################################################################################################
44
+ #Header of Streamlit-Magic-Sheet by github.com/tushar2704
45
+ #######################################################################################################
46
 
47
 
48
 
49
+ #main_header
50
+ main_header(title="Streamlit Magic Cheat Sheets",
51
+ header=None,
52
+ subheader=None,
53
+ markdown=None
54
+ )
55
 
56
 
57
+ left_main_panel()
58
 
59
 
60
 
 
65
 
66
 
67
 
68
+ #st.write(whole)
69
+ #instance
70
 
71
 
72
+ # col1, col2=st.columns((1,2), gap="large")
73
 
74
+ # inst=test_1()
75
+ # col1=inst.cs_sidebar()
76
 
77
+ # col2=inst.cs_sidebar2()
78
 
79
 
80
 
config/config.yaml ADDED
File without changes
custom_styles.css ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Set the page width to 80% */
2
+ .reportview-container {
3
+ width: 80%;
4
+ }
5
+
6
+
7
+ .stApp > header {
8
+ background-color: transparent;
9
+ }
10
+ .stApp {
11
+ margin: auto;
12
+ font-family: 'Roboto', sans-serif;
13
+ overflow: auto;
14
+ background: -webkit-linear-gradient(to right, #ecebe9, #f2f2f2, #dbdbdb, #eaeaea); /* Chrome 10-25, Safari 5.1-6 */
15
+ background: linear-gradient(to right, #f6f5f2, #f2f2f2, #dbdbdb, #eaeaea); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
16
+ animation: gradient 15s ease infinite;
17
+ background-size: 400% 400%;
18
+ background-attachment: fixed;
19
+ }
20
+
21
+ /* Gradient background for Streamlit sidebar */
22
+ .sidebar-content {
23
+ background-image: linear-gradient(to bottom, #ada996, #1041c8);
24
+ color: white;
25
+ padding: 20px;
26
+ border-radius: 10px;
27
+ }
28
+
29
+ .st-emotion-cache-16txtl3 {
30
+ padding: 0.01rem 0.01rem;
31
+ }
32
+
33
+
34
+
requirements.txt CHANGED
@@ -1,2 +1,16 @@
1
  streamlit
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  streamlit
2
+ pathlib
3
+ pybase64
4
+ requests
5
+ streamlit-option-menu
6
+ streamlit_antd_components
7
+ altair
8
+ plotly
9
+ bokeh==2.4.3
10
+ pydeck
11
+ graphviz
12
+ scipy
13
+ datetime
14
+ pandas
15
+ numpy
16
+ -e.
research/magic_sheet.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##© 2023 Tushar Aggarwal. All rights reserved.
2
+ ##Streamlit-Magic-Sheet
3
+ #######################################################################################################
4
+
5
+ #######################################################################################################
6
+ #Importind required libraries
7
+ #######################################################################################################
8
+
9
+ import streamlit as st
10
+ from pathlib import Path
11
+ import base64
12
+ import sys
13
+ from pathlib import Path
14
+ script_dir = Path(__file__).resolve().parent
15
+ project_root = script_dir.parent
16
+ sys.path.append(str(project_root))
17
+ #######################################################################################################
18
+ #Importing from SRC
19
+ #######################################################################################################
20
+ from src.Streamlit_Magic_Sheet.components.header import *
21
+ from src.Streamlit_Magic_Sheet.components.body import *
22
+ from src.Streamlit_Magic_Sheet.components.navigation import *
23
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
24
+ from src.Streamlit_Magic_Sheet.components.metrics import *
25
+ from src.Streamlit_Magic_Sheet.components.charts import *
26
+ from src.Streamlit_Magic_Sheet.components.test import *
27
+
28
+ #######################################################################################################
29
+ #Research
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
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
setup.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import setuptools
2
+
3
+ with open("README.md", "r", encoding="utf-8") as f:
4
+ long_description = f.read()
5
+
6
+
7
+ __version__ = "1.0.0"
8
+
9
+ REPO_NAME = "Streamlit-Magic-Sheet"
10
+ AUTHOR_USER_NAME = "tushar2704"
11
+ SRC_REPO = "Streamlit-Magic-Sheet"
12
+ AUTHOR_EMAIL = "tushar.27041994@gmail.com"
13
+
14
+
15
+ setuptools.setup(
16
+ name=SRC_REPO,
17
+ version=__version__,
18
+ author=AUTHOR_USER_NAME,
19
+ author_email=AUTHOR_EMAIL,
20
+ description="Streamlit-Magic-Sheet - ST App",
21
+ long_description=long_description,
22
+ long_description_content="text/markdown",
23
+ url=f"https://github.com/{AUTHOR_USER_NAME}/{REPO_NAME}",
24
+ project_urls={
25
+ "Bug Tracker": f"https://github.com/{AUTHOR_USER_NAME}/{REPO_NAME}/issues",
26
+ },
27
+ package_dir={"": "src"},
28
+ packages=setuptools.find_packages(where="src")
29
+ )
src/Streamlit_Magic_Sheet/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/components/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/components/body.py ADDED
The diff for this file is too large to render. See raw diff
 
src/Streamlit_Magic_Sheet/components/charts.py ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import random
6
+ # import duckdb
7
+ # import pandas as pd
8
+ # import plotly.express as px
9
+ # import plotly.graph_objects as go
10
+ # import streamlit as st
11
+ import sys
12
+ from pathlib import Path
13
+ script_dir = Path(__file__).resolve().parent
14
+ project_root = script_dir.parent
15
+ sys.path.append(str(project_root))
16
+ ########################################################################################################
17
+ #######################################################################################################
18
+ #Importing from SRC
19
+ #######################################################################################################
20
+ from src.Streamlit_Magic_Sheet.components.header import *
21
+ from src.Streamlit_Magic_Sheet.components.body import *
22
+ from src.Streamlit_Magic_Sheet.components.navigation import *
23
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
24
+ from src.Streamlit_Magic_Sheet.components.metrics import *
25
+ from src.Streamlit_Magic_Sheet.components.charts import *
26
+ from src.Streamlit_Magic_Sheet.components.test import *
27
+ from src.Streamlit_Magic_Sheet.components.elements import *
28
+ #######################################################################################################
29
+
30
+ def plot_metric(label, value, prefix="", suffix="", show_graph=False, color_graph=""):
31
+ fig = go.Figure()
32
+
33
+ fig.add_trace(
34
+ go.Indicator(
35
+ value=value,
36
+ gauge={"axis": {"visible": False}},
37
+ number={
38
+ "prefix": prefix,
39
+ "suffix": suffix,
40
+ "font.size": 28,
41
+ },
42
+ title={
43
+ "text": label,
44
+ "font": {"size": 24},
45
+ },
46
+ )
47
+ )
48
+
49
+ if show_graph:
50
+ fig.add_trace(
51
+ go.Scatter(
52
+ y=random.sample(range(0, 101), 30),
53
+ hoverinfo="skip",
54
+ fill="tozeroy",
55
+ fillcolor=color_graph,
56
+ line={
57
+ "color": color_graph,
58
+ },
59
+ )
60
+ )
61
+
62
+ fig.update_xaxes(visible=False, fixedrange=True)
63
+ fig.update_yaxes(visible=False, fixedrange=True)
64
+ fig.update_layout(
65
+ # paper_bgcolor="lightgrey",
66
+ margin=dict(t=30, b=0),
67
+ showlegend=False,
68
+ plot_bgcolor="white",
69
+ height=100,
70
+ )
71
+
72
+ st.plotly_chart(fig, use_container_width=True)
73
+
74
+
75
+ def plot_gauge(
76
+ indicator_number, indicator_color, indicator_suffix, indicator_title, max_bound
77
+ ):
78
+ fig = go.Figure(
79
+ go.Indicator(
80
+ value=indicator_number,
81
+ mode="gauge+number",
82
+ domain={"x": [0, 1], "y": [0, 1]},
83
+ number={
84
+ "suffix": indicator_suffix,
85
+ "font.size": 26,
86
+ },
87
+ gauge={
88
+ "axis": {"range": [0, max_bound], "tickwidth": 1},
89
+ "bar": {"color": indicator_color},
90
+ },
91
+ title={
92
+ "text": indicator_title,
93
+ "font": {"size": 28},
94
+ },
95
+ )
96
+ )
97
+ fig.update_layout(
98
+ # paper_bgcolor="lightgrey",
99
+ height=200,
100
+ margin=dict(l=10, r=10, t=50, b=10, pad=8),
101
+ )
102
+ st.plotly_chart(fig, use_container_width=True)
103
+
104
+
105
+ def plot_top_right():
106
+ sales_data = duckdb.sql(
107
+ f"""
108
+ WITH sales_data AS (
109
+ UNPIVOT (
110
+ SELECT
111
+ Scenario,
112
+ business_unit,
113
+ {','.join(all_months)}
114
+ FROM df
115
+ WHERE Year='2023'
116
+ AND Account='Sales'
117
+ )
118
+ ON {','.join(all_months)}
119
+ INTO
120
+ NAME month
121
+ VALUE sales
122
+ ),
123
+
124
+ aggregated_sales AS (
125
+ SELECT
126
+ Scenario,
127
+ business_unit,
128
+ SUM(sales) AS sales
129
+ FROM sales_data
130
+ GROUP BY Scenario, business_unit
131
+ )
132
+
133
+ SELECT * FROM aggregated_sales
134
+ """
135
+ ).df()
136
+
137
+ fig = px.bar(
138
+ sales_data,
139
+ x="business_unit",
140
+ y="sales",
141
+ color="Scenario",
142
+ barmode="group",
143
+ text_auto=".2s",
144
+ title="Sales for Year 2023",
145
+ height=400,
146
+ )
147
+ fig.update_traces(
148
+ textfont_size=12, textangle=0, textposition="outside", cliponaxis=False
149
+ )
150
+ st.plotly_chart(fig, use_container_width=True)
151
+
152
+
153
+ def plot_bottom_left():
154
+ sales_data = duckdb.sql(
155
+ f"""
156
+ WITH sales_data AS (
157
+ SELECT
158
+ Scenario,{','.join(all_months)}
159
+ FROM df
160
+ WHERE Year='2023'
161
+ AND Account='Sales'
162
+ AND business_unit='Software'
163
+ )
164
+
165
+ UNPIVOT sales_data
166
+ ON {','.join(all_months)}
167
+ INTO
168
+ NAME month
169
+ VALUE sales
170
+ """
171
+ ).df()
172
+
173
+ fig = px.line(
174
+ sales_data,
175
+ x="month",
176
+ y="sales",
177
+ color="Scenario",
178
+ markers=True,
179
+ text="sales",
180
+ title="Monthly Budget vs Forecast 2023",
181
+ )
182
+ fig.update_traces(textposition="top center")
183
+ st.plotly_chart(fig, use_container_width=True)
184
+
185
+
186
+ def plot_bottom_right():
187
+ sales_data = duckdb.sql(
188
+ f"""
189
+ WITH sales_data AS (
190
+ UNPIVOT (
191
+ SELECT
192
+ Account,Year,{','.join([f'ABS({month}) AS {month}' for month in all_months])}
193
+ FROM df
194
+ WHERE Scenario='Actuals'
195
+ AND Account!='Sales'
196
+ )
197
+ ON {','.join(all_months)}
198
+ INTO
199
+ NAME year
200
+ VALUE sales
201
+ ),
202
+
203
+ aggregated_sales AS (
204
+ SELECT
205
+ Account,
206
+ Year,
207
+ SUM(sales) AS sales
208
+ FROM sales_data
209
+ GROUP BY Account, Year
210
+ )
211
+
212
+ SELECT * FROM aggregated_sales
213
+ """
214
+ ).df()
215
+
216
+ fig = px.bar(
217
+ sales_data,
218
+ x="Year",
219
+ y="sales",
220
+ color="Account",
221
+ title="Actual Yearly Sales Per Account",
222
+ )
223
+ st.plotly_chart(fig, use_container_width=True)
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
src/Streamlit_Magic_Sheet/components/elements.py ADDED
@@ -0,0 +1,1586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import random
6
+
7
+ import pandas as pd
8
+
9
+ import numpy as np
10
+ import altair as alt
11
+ import plotly.figure_factory as ff
12
+ from bokeh.plotting import figure
13
+ import pydeck as pdk
14
+ import graphviz
15
+ import scipy
16
+ import datetime
17
+ import requests
18
+ # import plotly.express as px
19
+ # import plotly.graph_objects as go
20
+ import streamlit as st
21
+ import time
22
+ import sys
23
+ from pathlib import Path
24
+ script_dir = Path(__file__).resolve().parent
25
+ project_root = script_dir.parent
26
+ sys.path.append(str(project_root))
27
+ ########################################################################################################
28
+ #######################################################################################################
29
+ # #Importing from SRC
30
+ # #######################################################################################################
31
+ # from src.Streamlit_Magic_Sheet.components.header import *
32
+ # from src.Streamlit_Magic_Sheet.components.body import *
33
+ # from src.Streamlit_Magic_Sheet.components.navigation import *
34
+ # from src.Streamlit_Magic_Sheet.components.siderbar import *
35
+ # from src.Streamlit_Magic_Sheet.components.metrics import *
36
+ # from src.Streamlit_Magic_Sheet.components.charts import *
37
+ # from src.Streamlit_Magic_Sheet.components.test import *
38
+ # from src.Streamlit_Magic_Sheet.components.elements import *
39
+ #######################################################################################################
40
+
41
+ ######################################################################################################
42
+ # Elements
43
+ ######################################################################################################
44
+
45
+
46
+
47
+ #################
48
+ # Chart Elements
49
+ #################
50
+ def altair():
51
+ chart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])
52
+
53
+ c = (
54
+ alt.Chart(chart_data)
55
+ .mark_circle()
56
+ .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])
57
+ )
58
+
59
+ st.altair_chart(c, use_container_width=True)
60
+
61
+ def vega_chart():
62
+ chart_data = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"])
63
+
64
+ st.vega_lite_chart(
65
+ chart_data,
66
+ {
67
+ "mark": {"type": "circle", "tooltip": True},
68
+ "encoding": {
69
+ "x": {"field": "a", "type": "quantitative"},
70
+ "y": {"field": "b", "type": "quantitative"},
71
+ "size": {"field": "c", "type": "quantitative"},
72
+ "color": {"field": "c", "type": "quantitative"},
73
+ },
74
+ },
75
+ )
76
+
77
+ def plotly():
78
+ # Add histogram data
79
+ x1 = np.random.randn(200) - 2
80
+ x2 = np.random.randn(200)
81
+ x3 = np.random.randn(200) + 2
82
+
83
+ # Group data together
84
+ hist_data = [x1, x2, x3]
85
+
86
+ group_labels = ['Group 1', 'Group 2', 'Group 3']
87
+
88
+ # Create distplot with custom bin_size
89
+ fig = ff.create_distplot(
90
+ hist_data, group_labels, bin_size=[.1, .25, .5])
91
+
92
+ # Plot!
93
+ st.plotly_chart(fig, use_container_width=True)
94
+
95
+ def bokeh():
96
+
97
+
98
+ x = [1, 2, 3, 4, 5]
99
+ y = [6, 7, 2, 4, 5]
100
+
101
+ p = figure(
102
+ title='simple line example',
103
+ x_axis_label='x',
104
+ y_axis_label='y')
105
+
106
+ p.line(x, y, legend_label='Trend', line_width=2)
107
+
108
+ st.bokeh_chart(p, use_container_width=True)
109
+
110
+ def pydeck():
111
+
112
+
113
+
114
+
115
+ chart_data = pd.DataFrame(
116
+ np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
117
+ columns=['lat', 'lon'])
118
+
119
+ st.pydeck_chart(pdk.Deck(
120
+ map_style=None,
121
+ initial_view_state=pdk.ViewState(
122
+ latitude=37.76,
123
+ longitude=-122.4,
124
+ zoom=11,
125
+ pitch=50,
126
+ ),
127
+ layers=[
128
+ pdk.Layer(
129
+ 'HexagonLayer',
130
+ data=chart_data,
131
+ get_position='[lon, lat]',
132
+ radius=200,
133
+ elevation_scale=4,
134
+ elevation_range=[0, 1000],
135
+ pickable=True,
136
+ extruded=True,
137
+ ),
138
+ pdk.Layer(
139
+ 'ScatterplotLayer',
140
+ data=chart_data,
141
+ get_position='[lon, lat]',
142
+ get_color='[200, 30, 0, 160]',
143
+ get_radius=200,
144
+ ),
145
+ ],
146
+ ))
147
+
148
+ def graphviz1():
149
+
150
+
151
+ # Create a graphlib graph object
152
+ graph = graphviz.Digraph()
153
+ graph.edge('run', 'intr')
154
+ graph.edge('intr', 'runbl')
155
+ graph.edge('runbl', 'run')
156
+ graph.edge('run', 'kernel')
157
+ graph.edge('kernel', 'zombie')
158
+ graph.edge('kernel', 'sleep')
159
+ graph.edge('kernel', 'runmem')
160
+ graph.edge('sleep', 'swap')
161
+ graph.edge('swap', 'runswap')
162
+ graph.edge('runswap', 'new')
163
+ graph.edge('runswap', 'runmem')
164
+ graph.edge('new', 'runmem')
165
+ graph.edge('sleep', 'runmem')
166
+
167
+ st.graphviz_chart(graph)
168
+
169
+ def map():
170
+ df = pd.DataFrame(
171
+ np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
172
+ columns=['lat', 'lon'])
173
+
174
+ st.map(df)
175
+
176
+ #################
177
+ # Input Elements
178
+ #################
179
+ def button():
180
+ st.button("Tushar", type="primary")
181
+ if st.button('Saying hello'):
182
+ st.write('Why hello there')
183
+ else:
184
+ st.write('Goodbye')
185
+
186
+ def download():
187
+ text_contents = '''This is some text'''
188
+ st.download_button('Download some text', text_contents)
189
+
190
+ def link():
191
+ st.link_button("Go to Tushar-Aggarwal.com", "https://tushar-aggarwal.com")
192
+
193
+ def checkbox():
194
+ agree = st.checkbox('Tushar is great')
195
+
196
+ if agree:
197
+ st.write('Yes indeed!')
198
+
199
+ def toggle():
200
+ on = st.toggle('Activate feature')
201
+
202
+ if on:
203
+ st.write('Feature activated!')
204
+
205
+ def radio():
206
+
207
+ genre = st.radio(
208
+ "What's your favorite movie genre",
209
+ [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],
210
+ captions = ["Laugh out loud.", "Get the popcorn.", "Never stop learning."])
211
+
212
+ if genre == ':rainbow[Comedy]':
213
+ st.write('You selected comedy.')
214
+ else:
215
+ st.write("You didn\'t select comedy.")
216
+
217
+ def option():
218
+ option = st.selectbox(
219
+ "How would you like to be contacted?",
220
+ ("Email", "Home phone", "Mobile phone"),
221
+ index=None,
222
+ placeholder="Select contact method...",
223
+ )
224
+
225
+ st.write('You selected:', option)
226
+
227
+ def multiselect():
228
+ options = st.multiselect(
229
+ 'What are your favorite colors',
230
+ ['Green', 'Yellow', 'Red', 'Blue'],
231
+ ['Yellow', 'Red'])
232
+
233
+ st.write('You selected:', options)
234
+
235
+ def slider():
236
+ values = st.slider(
237
+ 'Select a range of values',
238
+ 0.0, 100.0, (25.0, 75.0))
239
+ st.write('Values:', values)
240
+
241
+ def select_slider():
242
+ start_color, end_color = st.select_slider(
243
+ 'Select a range of color wavelength',
244
+ options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'],
245
+ value=('red', 'blue'))
246
+ st.write('You selected wavelengths between', start_color, 'and', end_color)
247
+
248
+ def text_input():
249
+ title = st.text_input('Movie title', 'Life of Brian')
250
+ st.write('The current movie title is', title)
251
+
252
+ def number_input():
253
+ number = st.number_input('Insert a number')
254
+ st.write('The current number is ', number)
255
+
256
+ def text_area():
257
+ txt = st.text_area(
258
+ "Text to analyze",
259
+ "It was the best of times, it was the worst of times, it was the age of "
260
+ "wisdom, it was the age of foolishness, it was the epoch of belief, it "
261
+ "was the epoch of incredulity, it was the season of Light, it was the "
262
+ "season of Darkness, it was the spring of hope, it was the winter of "
263
+ "despair, (...)",
264
+ )
265
+ st.write(f'You wrote {len(txt)} characters.')
266
+
267
+ def date_input():
268
+
269
+
270
+ today = datetime.datetime.now()
271
+ next_year = today.year + 1
272
+ jan_1 = datetime.date(next_year, 1, 1)
273
+ dec_31 = datetime.date(next_year, 12, 31)
274
+
275
+ d = st.date_input(
276
+ "Select your vacation for next year",
277
+ (jan_1, datetime.date(next_year, 1, 7)),
278
+ jan_1,
279
+ dec_31,
280
+ format="MM.DD.YYYY",
281
+ )
282
+ d
283
+
284
+ def time_input():
285
+ t = st.time_input('Set an alarm for', datetime.time(8, 45))
286
+
287
+ st.write('Alarm is set for', t)
288
+
289
+ def file_upload():
290
+ uploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=True)
291
+ for uploaded_file in uploaded_files:
292
+ bytes_data = uploaded_file.read()
293
+ st.write("filename:", uploaded_file.name)
294
+ st.write(bytes_data)
295
+
296
+ def camera_input():
297
+ picture = st.camera_input("Take a picture")
298
+
299
+ if picture:
300
+ st.image(picture)
301
+
302
+ def color_picker():
303
+ color = st.color_picker('Pick A Color', '#00f900')
304
+ st.write('The current color is', color)
305
+ #################
306
+ # Media Elements
307
+ #################
308
+ def image():
309
+ image_url = "https://images.unsplash.com/photo-1561564723-570b270e7c36"
310
+ st.image(image_url, caption='Amazing Sunrise', use_column_width=True)
311
+
312
+ def audio():
313
+ def get_random_fma_track():
314
+ base_url = "https://files.freemusicarchive.org/"
315
+ endpoint = "random/track"
316
+ response = requests.get(f"{base_url}{endpoint}")
317
+ if response.status_code == 200:
318
+ track_url = response.url
319
+ return track_url
320
+ return None
321
+
322
+ # Get a random FMA track URL
323
+ random_audio_url = get_random_fma_track()
324
+
325
+ # Display the audio player
326
+ if random_audio_url:
327
+ st.audio(random_audio_url, format="audio/mp3")
328
+ else:
329
+ st.write("Failed to fetch a random audio track. Please try again later.")
330
+
331
+ def video():
332
+ video_urls = [
333
+ "https://www.youtube.com/watch?v=VIDEO_ID_1",
334
+ "https://www.youtube.com/watch?v=VIDEO_ID_2",
335
+ "https://www.youtube.com/watch?v=VIDEO_ID_3",
336
+ # Add more YouTube video URLs here
337
+ ]
338
+
339
+ # Select a random video URL
340
+ random_video_url = random.choice(video_urls)
341
+
342
+ # Display the video
343
+ st.video(random_video_url)
344
+
345
+ def sidebar():
346
+
347
+
348
+ # Using object notation
349
+ add_selectbox = st.sidebar.selectbox(
350
+ "How would you like to be contacted?",
351
+ ("Email", "Home phone", "Mobile phone")
352
+ )
353
+
354
+ # Using "with" notation
355
+ with st.sidebar:
356
+ add_radio = st.radio(
357
+ "Choose a shipping method",
358
+ ("Standard (5-15 days)", "Express (2-5 days)")
359
+ )
360
+
361
+ #################
362
+ # Container Elements
363
+ #################
364
+ def columns():
365
+ cola, colb, colc = st.columns(3)
366
+
367
+ with cola:
368
+ st.header("A cat")
369
+ st.image("https://static.streamlit.io/examples/cat.jpg")
370
+
371
+ with colb:
372
+ st.header("A dog")
373
+ st.image("https://static.streamlit.io/examples/dog.jpg")
374
+
375
+ with colc:
376
+ st.header("An owl")
377
+ st.image("https://static.streamlit.io/examples/owl.jpg")
378
+
379
+ def tab():
380
+ tab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])
381
+
382
+ with tab1:
383
+ st.header("A cat")
384
+ st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
385
+
386
+ with tab2:
387
+ st.header("A dog")
388
+ st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
389
+
390
+ with tab3:
391
+ st.header("An owl")
392
+ st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
393
+
394
+ def expander():
395
+ chart = st.bar_chart({"data": [1, 5, 2, 6, 2, 1]})
396
+
397
+
398
+ chart
399
+ st.write("The chart above shows some randon numbers. st.expander help to hide elements by default and show ony when expanded")
400
+
401
+ def container():
402
+ with st.container():
403
+ st.write("This is inside the container")
404
+
405
+ # You can call any Streamlit command, including custom components:
406
+ st.bar_chart(np.random.randn(50, 3))
407
+
408
+
409
+ st.write("This is outside the container")
410
+
411
+ def empty():
412
+ placeholder = st.empty()
413
+
414
+ # Replace the placeholder with some text:
415
+ placeholder.text("Hello")
416
+
417
+ # Replace the text with a chart:
418
+ placeholder.line_chart({"data": [1, 5, 2, 6]})
419
+
420
+ # Replace the chart with several elements:
421
+ with placeholder.container():
422
+ st.write("This is one element")
423
+ st.write("This is another")
424
+
425
+ # Clear all those elements:
426
+ placeholder.empty()
427
+ #################
428
+ # Chat Elements
429
+ #################
430
+ def chat_message():
431
+ with st.chat_message("user"):
432
+ st.write("🤖 Hello 👋")
433
+ st.write("How may I help you today?")
434
+
435
+ def chat_input():
436
+ prompt = st.chat_input("How may I help you today?")
437
+ if prompt:
438
+ st.write(f"User has sent the following prompt: {prompt}")
439
+
440
+ #################
441
+ # Status Elements
442
+ #################
443
+
444
+ def progress():
445
+ progress_text = "Operation in progress. Please wait."
446
+ my_bar = st.progress(0, text=progress_text)
447
+
448
+ for percent_complete in range(100):
449
+ time.sleep(0.01)
450
+ my_bar.progress(percent_complete + 1, text=progress_text)
451
+ time.sleep(1)
452
+ my_bar.empty()
453
+
454
+ st.button("Rerun")
455
+
456
+ def spinner():
457
+ with st.spinner('Wait for it...'):
458
+ time.sleep(2)
459
+ st.success('Done!')
460
+
461
+ def status():
462
+ st.status("Downloading data...")
463
+ st.write("Searching for data...")
464
+ time.sleep(1)
465
+ st.write("Found URL.")
466
+ time.sleep(1)
467
+ st.write("Downloading data...")
468
+ time.sleep(1)
469
+
470
+ st.button('Rerun', key='1')
471
+
472
+ def toast():
473
+ st.toast('Your prompt was send for processing!', icon='😍')
474
+
475
+ def error():
476
+ st.error('There is an error', icon="🚨")
477
+
478
+ def warning():
479
+ st.warning('This task will utilize multiple resources, expect time delay', icon="⚠️")
480
+
481
+ def info():
482
+ st.info('This task will utilize paid API', icon="💵")
483
+
484
+ def success():
485
+ st.success('This is a success message!', icon="✅")
486
+
487
+ def exception():
488
+ e = RuntimeError('This is an exception of type RuntimeError')
489
+ st.exception(e)
490
+
491
+ #################
492
+ # Control Flow Elements
493
+ #################
494
+
495
+ def form():
496
+ form = st.form("Try Form")
497
+ form.slider("Inside the form")
498
+
499
+ st.slider("Outside the form")
500
+
501
+ # Now add a submit button to the form:
502
+ form.form_submit_button("Submit")
503
+
504
+ #################
505
+ # Utilities Elements
506
+ #################
507
+
508
+ def echo():
509
+ with st.echo():
510
+ st.write('Tushar is the best')
511
+
512
+ def help():
513
+ st.help(st.write)
514
+
515
+
516
+ #################
517
+ # Mutate Charts Elements
518
+ #################
519
+
520
+ def add_rows():
521
+ df1 = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))
522
+
523
+ my_table = st.table(df1)
524
+
525
+ df2 = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))
526
+
527
+ my_table.add_rows(df2)
528
+
529
+ #################
530
+ # Performance Elements
531
+ #################
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+
892
+
893
+
894
+
895
+
896
+
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+
977
+
978
+
979
+
980
+
981
+
982
+
983
+
984
+
985
+
986
+
987
+
988
+
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+
997
+
998
+
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+
1060
+
1061
+
1062
+
1063
+
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+
1070
+
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+
1209
+
1210
+
1211
+
1212
+
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+
1260
+
1261
+
1262
+
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+
1305
+
1306
+
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+
1361
+
1362
+
1363
+
1364
+
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+
1372
+
1373
+
1374
+
1375
+
1376
+
1377
+
1378
+
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+
1465
+
1466
+
1467
+
1468
+
1469
+
1470
+
1471
+
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+
1479
+
1480
+
1481
+
1482
+
1483
+
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+
1509
+
1510
+
1511
+
1512
+
1513
+
1514
+
1515
+
1516
+
1517
+
1518
+
1519
+
1520
+
1521
+
1522
+
1523
+
1524
+
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+
1533
+
1534
+
1535
+
1536
+
1537
+
1538
+
1539
+
1540
+
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+
1566
+
1567
+
1568
+
1569
+
1570
+
1571
+
1572
+
1573
+
1574
+
1575
+
1576
+
1577
+
1578
+
1579
+
1580
+
1581
+
1582
+
1583
+
1584
+
1585
+
1586
+
src/Streamlit_Magic_Sheet/components/header.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import streamlit as st
6
+ import sys
7
+ from pathlib import Path
8
+ script_dir = Path(__file__).resolve().parent
9
+ project_root = script_dir.parent
10
+ sys.path.append(str(project_root))
11
+ #######################################################################################################
12
+ #Importing from SRC
13
+ #######################################################################################################
14
+ from src.Streamlit_Magic_Sheet.components.header import *
15
+ from src.Streamlit_Magic_Sheet.components.body import *
16
+ from src.Streamlit_Magic_Sheet.components.navigation import *
17
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
18
+ from src.Streamlit_Magic_Sheet.components.metrics import *
19
+ from src.Streamlit_Magic_Sheet.components.charts import *
20
+ from src.Streamlit_Magic_Sheet.components.test import *
21
+ from src.Streamlit_Magic_Sheet.components.elements import *
22
+ #######################################################################################################
23
+
24
+ ##############################################################################################################
25
+ #Application Title functions
26
+ ##############################################################################################################
27
+
28
+ def main_header(title=None, header=None, subheader=None, markdown=None, write=None, code=None):
29
+ '''
30
+ Displaying Main Header conponents
31
+ '''
32
+ if title:
33
+ st.title(title)
34
+
35
+ if header:
36
+ st.header(header)
37
+
38
+ if subheader:
39
+ st.subheader(subheader)
40
+
41
+ if markdown:
42
+ st.markdown(markdown)
43
+
44
+ if write:
45
+ st.write(write)
46
+
47
+ if code:
48
+ st.code(code)
src/Streamlit_Magic_Sheet/components/metrics.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import random
6
+
7
+ import pandas as pd
8
+ # import plotly.express as px
9
+ # import plotly.graph_objects as go
10
+ import streamlit as st
11
+ import sys
12
+ from pathlib import Path
13
+ script_dir = Path(__file__).resolve().parent
14
+ project_root = script_dir.parent
15
+ sys.path.append(str(project_root))
16
+ ########################################################################################################
17
+ #######################################################################################################
18
+ #Importing from SRC
19
+ #######################################################################################################
20
+ from src.Streamlit_Magic_Sheet.components.header import *
21
+ from src.Streamlit_Magic_Sheet.components.body import *
22
+ from src.Streamlit_Magic_Sheet.components.navigation import *
23
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
24
+ from src.Streamlit_Magic_Sheet.components.metrics import *
25
+ from src.Streamlit_Magic_Sheet.components.charts import *
26
+ from src.Streamlit_Magic_Sheet.components.test import *
27
+ from src.Streamlit_Magic_Sheet.components.elements import *
28
+ #######################################################################################################
29
+
30
+ ######################################################################################################
31
+ #Page Config
32
+ ######################################################################################################
33
+
src/Streamlit_Magic_Sheet/components/navigation.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import random
6
+
7
+ import pandas as pd
8
+ # import plotly.express as px
9
+ # import plotly.graph_objects as go
10
+ import streamlit as st
11
+ import sys
12
+ from pathlib import Path
13
+ script_dir = Path(__file__).resolve().parent
14
+ project_root = script_dir.parent
15
+ sys.path.append(str(project_root))
16
+ ########################################################################################################
17
+ #######################################################################################################
18
+ #Importing from SRC
19
+ #######################################################################################################
20
+ from src.Streamlit_Magic_Sheet.components.header import *
21
+ from src.Streamlit_Magic_Sheet.components.body import *
22
+ from src.Streamlit_Magic_Sheet.components.navigation import *
23
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
24
+ from src.Streamlit_Magic_Sheet.components.metrics import *
25
+ from src.Streamlit_Magic_Sheet.components.charts import *
26
+ from src.Streamlit_Magic_Sheet.components.test import *
27
+ from src.Streamlit_Magic_Sheet.components.elements import *
28
+ #######################################################################################################
29
+
30
+ ######################################################################################################
31
+ #Page Config
32
+ ######################################################################################################
33
+
34
+
35
+ def page_config(page_title, page_icon, layout):
36
+ # Page config
37
+ st.set_page_config(
38
+ page_title=page_title,
39
+ page_icon=page_icon,
40
+ layout=layout
41
+ )
42
+ st.markdown('''<style>
43
+ div.block-container{padding-top:0.1rem;}
44
+ font-family: 'Roboto', sans-serif; /* Add Roboto font */
45
+ color: blue; /* Make the text blue */
46
+ </style>''',
47
+ unsafe_allow_html=True)
48
+ with open('custom_styles.css') as f:
49
+ css = f.read()
50
+ st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)
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
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
src/Streamlit_Magic_Sheet/components/siderbar.py ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Authot github.com/tushar2704
2
+ ##############################################################################################################
3
+ #Importing required library
4
+ ##############################################################################################################
5
+ import streamlit as st
6
+ from streamlit_option_menu import option_menu
7
+ import base64
8
+ import sys
9
+ from pathlib import Path
10
+ script_dir = Path(__file__).resolve().parent
11
+ project_root = script_dir.parent
12
+ sys.path.append(str(project_root))
13
+ # import streamlit_antd_components as sac
14
+ #######################################################################################################
15
+ #Importing from SRC
16
+ #######################################################################################################
17
+ from src.Streamlit_Magic_Sheet.components.header import *
18
+ from src.Streamlit_Magic_Sheet.components.body import *
19
+ from src.Streamlit_Magic_Sheet.components.navigation import *
20
+ from src.Streamlit_Magic_Sheet.components.metrics import *
21
+ from src.Streamlit_Magic_Sheet.components.charts import *
22
+ from src.Streamlit_Magic_Sheet.components.test import *
23
+ from src.Streamlit_Magic_Sheet.components.elements import *
24
+ #######################################################################################################
25
+
26
+ ##############################################################################################################
27
+ #Sidebar functions
28
+ ##############################################################################################################
29
+
30
+
31
+ def img_to_bytes(img_path):
32
+ img_bytes = Path(img_path).read_bytes()
33
+ encoded = base64.b64encode(img_bytes).decode()
34
+ return encoded
35
+
36
+
37
+ #Left Panel Navigation
38
+ def left_main_panel():
39
+ custom_css = f"""
40
+ <style>
41
+ .sidebar .stImage {{
42
+ display: block;
43
+ margin: 0;
44
+ padding: 0;
45
+ }}
46
+ .st-emotion-cache-10oheav {{padding: 0.1rem 0.2rem;}}
47
+ img{{
48
+ vertical-align: middle;
49
+ margin-right: 70px;
50
+ float:right;
51
+ }}
52
+ </style>
53
+ """
54
+
55
+ # Example usage in the Streamlit sidebar
56
+ st.sidebar.markdown(custom_css, unsafe_allow_html=True)
57
+ st.sidebar.markdown(f'''[<img src='data:image/png;base64,{img_to_bytes("src/Streamlit_Magic_Sheet/data unboxed.png")}' class='img-fluid' width=100 height=100>](https://Tushar-Aggarwal.com/)''', unsafe_allow_html=True)
58
+
59
+ st.sidebar.markdown(f"##### <span style='margin-left: 45px;'>[Tushar-Aggarwal.com](https://tushar-aggarwal.com/)</span>", unsafe_allow_html=True)
60
+
61
+ with st.sidebar:
62
+ main_navbar =option_menu(
63
+ menu_title="",
64
+ options=['Magic Sheet','Write and Magic','Text Elements', 'Data Elements', 'Chart Elements',
65
+ 'Input Widgtes', 'Media Elements', 'Layouts and Containers',
66
+ 'Chat Elements', 'Status Elements', 'Control Flow',
67
+ 'Utilities', 'Mutate Charts', 'State Management',
68
+ 'Performance', 'Personalization', 'Connections and Databases',
69
+ 'App Menu', 'Button Behavior and Examples', 'Caching',
70
+ 'Command Line Options', 'Configuration', 'Theming', 'Connecting To Data',
71
+ 'Dataframes', 'Forms', 'Add Statefulness to Apps', 'Widget Behavior',
72
+ 'Working With Timezones', 'Static File Serving',
73
+ 'Https Support', 'Secrects Management', 'Security Reminders',
74
+ 'Connect to Data Sources'],
75
+ icons=['magic','blockquote-left','body-text','bar-chart-line-fill', 'bar-chart',
76
+ 'input-cursor-text', 'collection-play-fill', 'columns-gap',
77
+ 'chat-right-text', 'briefcase', 'diagram-3',
78
+ 'collection', 'pie-chart-fill', 'kanban-fill',
79
+ 'speedometer', 'columns', 'hdd',
80
+ 'menu-button', 'check2-square', 'memory',
81
+ 'list-columns', 'gear', 'columns-gap', 'gear-wide-connected',
82
+ 'table', 'ui-checks', 'menu-app-fill', 'card-heading',
83
+ 'calendar-date', 'file-earmark-arrow-down',
84
+ 'ethernet', 'asterisk', 'key',
85
+ 'hdd'],
86
+ menu_icon="house-fill",
87
+ default_index=0,
88
+ )
89
+
90
+
91
+
92
+ # sac.tabs([
93
+ # sac.TabsItem(label=magic_sheet_uk(),icon='UK'),
94
+ # sac.TabsItem(label='FR', icon='FRANCE'),
95
+ # sac.TabsItem(label='DE', icon='GERMANY'),
96
+ # ], format_func='title', align='end', shape='card')
97
+
98
+
99
+ if main_navbar=="Magic Sheet":
100
+ magic_sheet_uk()
101
+
102
+ if main_navbar=="Text Elements":
103
+ text_elements()
104
+
105
+ if main_navbar=="Write and Magic":
106
+ write_and_magic()
107
+
108
+ if main_navbar=="Data Elements":
109
+ data_elements()
110
+
111
+ if main_navbar=="Chart Elements":
112
+ chart_elements()
113
+
114
+ if main_navbar=="Input Widgtes":
115
+ input_widgtes()
116
+
117
+ if main_navbar=="Media Elements":
118
+ media_elements()
119
+
120
+ if main_navbar=="Layouts and Containers":
121
+ layouts_and_containers()
122
+
123
+ if main_navbar=="Chat Elements":
124
+ chat_elements()
125
+
126
+ if main_navbar=="Status Elements":
127
+ status_elements()
128
+
129
+ if main_navbar=="Control Flow":
130
+ control_flow()
131
+
132
+ if main_navbar=="Utilities":
133
+ utilities()
134
+
135
+ if main_navbar=="Mutate Charts":
136
+ mutate_charts()
137
+
138
+ if main_navbar=="State Management":
139
+ state_management()
140
+
141
+ if main_navbar=="Performance":
142
+ performance()
143
+
144
+ if main_navbar=="Personalization":
145
+ personalization()
146
+
147
+ if main_navbar=="Connections and Databases":
148
+ connections_and_databases()
149
+
150
+ if main_navbar=="App Menu":
151
+ app_menu()
152
+
153
+ if main_navbar=="Button Behavior and Examples":
154
+ button_behavior_and_examples()
155
+
156
+ if main_navbar=="Caching":
157
+ caching()
158
+
159
+ if main_navbar=="Command Line Options,":
160
+ command_line_options()
161
+
162
+ if main_navbar=="Configuration":
163
+ configuration()
164
+
165
+ if main_navbar=="Theming":
166
+ theming()
167
+
168
+ if main_navbar=="Connecting To Data":
169
+ connecting_to_data()
170
+
171
+ if main_navbar=="Dataframes":
172
+ dataframes()
173
+
174
+ if main_navbar=="Forms":
175
+ forms()
176
+
177
+ if main_navbar=="Add Statefulness to Apps":
178
+ add_statefulness_to_apps()
179
+
180
+ if main_navbar=="Widget Behavior":
181
+ widget_behavior()
182
+
183
+ if main_navbar=="Working With Timezones":
184
+ working_with_timezones()
185
+
186
+ if main_navbar=="Static File Serving":
187
+ static_file_serving()
188
+
189
+ if main_navbar=="Https Support":
190
+ https_support()
191
+
192
+ if main_navbar=="Secrects Management":
193
+ secrects_management()
194
+
195
+ if main_navbar=="Security Reminders":
196
+ security_reminders()
197
+
198
+ if main_navbar=="Connect to Data Sources":
199
+ connect_to_data_sources()
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
src/Streamlit_Magic_Sheet/components/test.py ADDED
@@ -0,0 +1,845 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #######################################################################################################
2
+ #Importind required libraries
3
+ #######################################################################################################
4
+
5
+ import streamlit as st
6
+ import base64
7
+ import sys
8
+ from pathlib import Path
9
+ script_dir = Path(__file__).resolve().parent
10
+ project_root = script_dir.parent
11
+ sys.path.append(str(project_root))
12
+
13
+
14
+
15
+
16
+ #######################################################################################################
17
+ #Importing from SRC
18
+ #######################################################################################################
19
+ from src.Streamlit_Magic_Sheet.components.header import *
20
+ from src.Streamlit_Magic_Sheet.components.body import *
21
+ from src.Streamlit_Magic_Sheet.components.navigation import *
22
+ from src.Streamlit_Magic_Sheet.components.siderbar import *
23
+ from src.Streamlit_Magic_Sheet.components.metrics import *
24
+ from src.Streamlit_Magic_Sheet.components.charts import *
25
+ from src.Streamlit_Magic_Sheet.components.test import *
26
+ from src.Streamlit_Magic_Sheet.components.elements import *
27
+ #######################################################################################################
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+ # Initial page config
50
+ # class whole_app:
51
+ # st.set_page_config(
52
+ # page_title='Streamlit cheat sheet',
53
+ # layout="wide",
54
+ # initial_sidebar_state="expanded",
55
+ # )
56
+
57
+ # def main():
58
+ # cs_sidebar()
59
+ # cs_body()
60
+
61
+ # return None
62
+
63
+ # # Thanks to streamlitopedia for the following code snippet
64
+
65
+ # def img_to_bytes(img_path):
66
+ # img_bytes = Path(img_path).read_bytes()
67
+ # encoded = base64.b64encode(img_bytes).decode()
68
+ # return encoded
69
+
70
+ # # sidebar
71
+
72
+ # def cs_sidebar():
73
+
74
+ # #st.sidebar.markdown('''[<img src='data:image/png;base64,{}' class='img-fluid' width=32 height=32>](https://streamlit.io/)'''.format(img_to_bytes("logomark_website.png")), unsafe_allow_html=True)
75
+ # st.sidebar.header('Streamlit cheat sheet')
76
+
77
+ # st.sidebar.markdown('''
78
+ # <small>Summary of the [docs](https://docs.streamlit.io/), as of [Streamlit v1.25.0](https://www.streamlit.io/).</small>
79
+ # ''', unsafe_allow_html=True)
80
+
81
+ # st.sidebar.markdown('__Install and import__')
82
+
83
+ # st.sidebar.code('$ pip install streamlit')
84
+
85
+ # st.sidebar.code('''
86
+ # # Import convention
87
+ # >>> import streamlit as st
88
+ # ''')
89
+
90
+ # st.sidebar.markdown('__Add widgets to sidebar__')
91
+ # st.sidebar.code('''
92
+ # # Just add it after st.sidebar:
93
+ # >>> a = st.sidebar.radio(\'Choose:\',[1,2])
94
+ # ''')
95
+
96
+ # st.sidebar.markdown('__Magic commands__')
97
+ # st.sidebar.code('''
98
+ # '_This_ is some __Markdown__'
99
+ # a=3
100
+ # 'dataframe:', data
101
+ # ''')
102
+
103
+ # st.sidebar.markdown('__Command line__')
104
+ # st.sidebar.code('''
105
+ # $ streamlit --help
106
+ # $ streamlit run your_script.py
107
+ # $ streamlit hello
108
+ # $ streamlit config show
109
+ # $ streamlit cache clear
110
+ # $ streamlit docs
111
+ # $ streamlit --version
112
+ # ''')
113
+
114
+ # st.sidebar.markdown('__Pre-release features__')
115
+ # st.sidebar.code('''
116
+ # pip uninstall streamlit
117
+ # pip install streamlit-nightly --upgrade
118
+ # ''')
119
+ # st.sidebar.markdown('<small>Learn more about [experimental features](https://docs.streamlit.io/library/advanced-features/prerelease#beta-and-experimental-features)</small>', unsafe_allow_html=True)
120
+
121
+ # st.sidebar.markdown('''<hr>''', unsafe_allow_html=True)
122
+ # st.sidebar.markdown('''<small>[Cheat sheet v1.25.0](https://github.com/daniellewisDL/streamlit-cheat-sheet) | Aug 2023 | [Daniel Lewis](https://daniellewisdl.github.io/)</small>''', unsafe_allow_html=True)
123
+
124
+ # return None
125
+
126
+ # ##########################
127
+ # # Main body of cheat sheet
128
+ # ##########################
129
+
130
+ # def cs_body():
131
+
132
+ # col1, col2, col3 = st.columns(3)
133
+
134
+ # #######################################
135
+ # # COLUMN 1
136
+ # #######################################
137
+
138
+ # # Display text
139
+
140
+ # col1.subheader('Display text')
141
+ # col1.code('''
142
+ # st.text('Fixed width text')
143
+ # st.markdown('_Markdown_') # see #*
144
+ # st.caption('Balloons. Hundreds of them...')
145
+ # st.latex(r\'\'\' e^{i\pi} + 1 = 0 \'\'\')
146
+ # st.write('Most objects') # df, err, func, keras!
147
+ # st.write(['st', 'is <', 3]) # see *
148
+ # st.title('My title')
149
+ # st.header('My header')
150
+ # st.subheader('My sub')
151
+ # st.code('for i in range(8): foo()')
152
+
153
+ # # * optional kwarg unsafe_allow_html = True
154
+
155
+ # ''')
156
+
157
+ # # Display data
158
+
159
+ # col1.subheader('Display data')
160
+ # col1.code('''
161
+ # st.dataframe(my_dataframe)
162
+ # st.table(data.iloc[0:10])
163
+ # st.json({'foo':'bar','fu':'ba'})
164
+ # st.metric(label="Temp", value="273 K", delta="1.2 K")
165
+ # ''')
166
+
167
+
168
+ # # Display media
169
+
170
+ # col1.subheader('Display media')
171
+ # col1.code('''
172
+ # st.image('./header.png')
173
+ # st.audio(data)
174
+ # st.video(data)
175
+ # ''')
176
+
177
+ # # Columns
178
+
179
+ # col1.subheader('Columns')
180
+ # col1.code('''
181
+ # col1, col2 = st.columns(2)
182
+ # col1.write('Column 1')
183
+ # col2.write('Column 2')
184
+
185
+ # # Three columns with different widths
186
+ # col1, col2, col3 = st.columns([3,1,1])
187
+ # # col1 is wider
188
+
189
+ # # Using 'with' notation:
190
+ # >>> with col1:
191
+ # >>> st.write('This is column 1')
192
+
193
+ # ''')
194
+
195
+ # # Tabs
196
+
197
+ # col1.subheader('Tabs')
198
+ # col1.code('''
199
+ # # Insert containers separated into tabs:
200
+ # >>> tab1, tab2 = st.tabs(["Tab 1", "Tab2"])
201
+ # >>> tab1.write("this is tab 1")
202
+ # >>> tab2.write("this is tab 2")
203
+
204
+ # # You can also use "with" notation:
205
+ # >>> with tab1:
206
+ # >>> st.radio('Select one:', [1, 2])
207
+ # ''')
208
+
209
+ # # Control flow
210
+
211
+ # col1.subheader('Control flow')
212
+ # col1.code('''
213
+ # # Stop execution immediately:
214
+ # st.stop()
215
+ # # Rerun script immediately:
216
+ # st.experimental_rerun()
217
+
218
+ # # Group multiple widgets:
219
+ # >>> with st.form(key='my_form'):
220
+ # >>> username = st.text_input('Username')
221
+ # >>> password = st.text_input('Password')
222
+ # >>> st.form_submit_button('Login')
223
+ # ''')
224
+
225
+ # # Personalize apps for users
226
+
227
+ # col1.subheader('Personalize apps for users')
228
+ # col1.code('''
229
+ # # Show different content based on the user's email address.
230
+ # >>> if st.user.email == 'jane@email.com':
231
+ # >>> display_jane_content()
232
+ # >>> elif st.user.email == 'adam@foocorp.io':
233
+ # >>> display_adam_content()
234
+ # >>> else:
235
+ # >>> st.write("Please contact us to get access!")
236
+ # ''')
237
+
238
+
239
+ # #######################################
240
+ # # COLUMN 2
241
+ # #######################################
242
+
243
+ # # Display interactive widgets
244
+
245
+ # col2.subheader('Display interactive widgets')
246
+ # col2.code('''
247
+ # st.button('Hit me')
248
+ # st.data_editor('Edit data', data)
249
+ # st.checkbox('Check me out')
250
+ # st.radio('Pick one:', ['nose','ear'])
251
+ # st.selectbox('Select', [1,2,3])
252
+ # st.multiselect('Multiselect', [1,2,3])
253
+ # st.slider('Slide me', min_value=0, max_value=10)
254
+ # st.select_slider('Slide to select', options=[1,'2'])
255
+ # st.text_input('Enter some text')
256
+ # st.number_input('Enter a number')
257
+ # st.text_area('Area for textual entry')
258
+ # st.date_input('Date input')
259
+ # st.time_input('Time entry')
260
+ # st.file_uploader('File uploader')
261
+ # st.download_button('On the dl', data)
262
+ # st.camera_input("一二三,茄子!")
263
+ # st.color_picker('Pick a color')
264
+ # ''')
265
+
266
+ # col2.code('''
267
+ # # Use widgets\' returned values in variables
268
+ # >>> for i in range(int(st.number_input('Num:'))): foo()
269
+ # >>> if st.sidebar.selectbox('I:',['f']) == 'f': b()
270
+ # >>> my_slider_val = st.slider('Quinn Mallory', 1, 88)
271
+ # >>> st.write(slider_val)
272
+ # ''')
273
+ # col2.code('''
274
+ # # Disable widgets to remove interactivity:
275
+ # >>> st.slider('Pick a number', 0, 100, disabled=True)
276
+ # ''')
277
+
278
+ # # Build chat-based apps
279
+
280
+ # col2.subheader('Build chat-based apps')
281
+ # col2.code('''
282
+ # # Insert a chat message container.
283
+ # >>> with st.chat_message("user"):
284
+ # >>> st.write("Hello 👋")
285
+ # >>> st.line_chart(np.random.randn(30, 3))
286
+
287
+ # # Display a chat input widget.
288
+ # >>> st.chat_input("Say something")
289
+ # ''')
290
+
291
+ # col2.markdown('<small>Learn how to [build chat-based apps](https://docs.streamlit.io/knowledge-base/tutorials/build-conversational-apps)</small>', unsafe_allow_html=True)
292
+
293
+ # # Mutate data
294
+
295
+ # col2.subheader('Mutate data')
296
+ # col2.code('''
297
+ # # Add rows to a dataframe after
298
+ # # showing it.
299
+ # >>> element = st.dataframe(df1)
300
+ # >>> element.add_rows(df2)
301
+
302
+ # # Add rows to a chart after
303
+ # # showing it.
304
+ # >>> element = st.line_chart(df1)
305
+ # >>> element.add_rows(df2)
306
+ # ''')
307
+
308
+ # # Display code
309
+
310
+ # col2.subheader('Display code')
311
+ # col2.code('''
312
+ # st.echo()
313
+ # >>> with st.echo():
314
+ # >>> st.write('Code will be executed and printed')
315
+ # ''')
316
+
317
+ # # Placeholders, help, and options
318
+
319
+ # col2.subheader('Placeholders, help, and options')
320
+ # col2.code('''
321
+ # # Replace any single element.
322
+ # >>> element = st.empty()
323
+ # >>> element.line_chart(...)
324
+ # >>> element.text_input(...) # Replaces previous.
325
+
326
+ # # Insert out of order.
327
+ # >>> elements = st.container()
328
+ # >>> elements.line_chart(...)
329
+ # >>> st.write("Hello")
330
+ # >>> elements.text_input(...) # Appears above "Hello".
331
+
332
+ # st.help(pandas.DataFrame)
333
+ # st.get_option(key)
334
+ # st.set_option(key, value)
335
+ # st.set_page_config(layout='wide')
336
+ # st.experimental_show(objects)
337
+ # st.experimental_get_query_params()
338
+ # st.experimental_set_query_params(**params)
339
+ # ''')
340
+
341
+ # #######################################
342
+ # # COLUMN 3
343
+ # #######################################
344
+
345
+
346
+ # # Connect to data sources
347
+
348
+ # col3.subheader('Connect to data sources')
349
+
350
+ # col3.code('''
351
+ # st.experimental_connection('pets_db', type='sql')
352
+ # conn = st.experimental_connection('sql')
353
+ # conn = st.experimental_connection('snowpark')
354
+
355
+ # >>> class MyConnection(ExperimentalBaseConnection[myconn.MyConnection]):
356
+ # >>> def _connect(self, **kwargs) -> MyConnection:
357
+ # >>> return myconn.connect(**self._secrets, **kwargs)
358
+ # >>> def query(self, query):
359
+ # >>> return self._instance.query(query)
360
+ # ''')
361
+
362
+
363
+ # # Optimize performance
364
+
365
+ # col3.subheader('Optimize performance')
366
+ # col3.write('Cache data objects')
367
+ # col3.code('''
368
+ # # E.g. Dataframe computation, storing downloaded data, etc.
369
+ # >>> @st.cache_data
370
+ # ... def foo(bar):
371
+ # ... # Do something expensive and return data
372
+ # ... return data
373
+ # # Executes foo
374
+ # >>> d1 = foo(ref1)
375
+ # # Does not execute foo
376
+ # # Returns cached item by value, d1 == d2
377
+ # >>> d2 = foo(ref1)
378
+ # # Different arg, so function foo executes
379
+ # >>> d3 = foo(ref2)
380
+ # # Clear all cached entries for this function
381
+ # >>> foo.clear()
382
+ # # Clear values from *all* in-memory or on-disk cached functions
383
+ # >>> st.cache_data.clear()
384
+ # ''')
385
+ # col3.write('Cache global resources')
386
+ # col3.code('''
387
+ # # E.g. TensorFlow session, database connection, etc.
388
+ # >>> @st.cache_resource
389
+ # ... def foo(bar):
390
+ # ... # Create and return a non-data object
391
+ # ... return session
392
+ # # Executes foo
393
+ # >>> s1 = foo(ref1)
394
+ # # Does not execute foo
395
+ # # Returns cached item by reference, s1 == s2
396
+ # >>> s2 = foo(ref1)
397
+ # # Different arg, so function foo executes
398
+ # >>> s3 = foo(ref2)
399
+ # # Clear all cached entries for this function
400
+ # >>> foo.clear()
401
+ # # Clear all global resources from cache
402
+ # >>> st.cache_resource.clear()
403
+ # ''')
404
+ # col3.write('Deprecated caching')
405
+ # col3.code('''
406
+ # >>> @st.cache
407
+ # ... def foo(bar):
408
+ # ... # Do something expensive in here...
409
+ # ... return data
410
+ # >>> # Executes foo
411
+ # >>> d1 = foo(ref1)
412
+ # >>> # Does not execute foo
413
+ # >>> # Returns cached item by reference, d1 == d2
414
+ # >>> d2 = foo(ref1)
415
+ # >>> # Different arg, so function foo executes
416
+ # >>> d3 = foo(ref2)
417
+ # ''')
418
+
419
+
420
+ # # Display progress and status
421
+
422
+ # col3.subheader('Display progress and status')
423
+ # col3.code('''
424
+ # # Show a spinner during a process
425
+ # >>> with st.spinner(text='In progress'):
426
+ # >>> time.sleep(3)
427
+ # >>> st.success('Done')
428
+
429
+ # # Show and update progress bar
430
+ # >>> bar = st.progress(50)
431
+ # >>> time.sleep(3)
432
+ # >>> bar.progress(100)
433
+
434
+ # st.balloons()
435
+ # st.snow()
436
+ # st.toast('Mr Stay-Puft')
437
+ # st.error('Error message')
438
+ # st.warning('Warning message')
439
+ # st.info('Info message')
440
+ # st.success('Success message')
441
+ # st.exception(e)
442
+ # ''')
443
+
444
+
445
+ # return None
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+ class test_1:
456
+ def __init__(self):
457
+ pass
458
+
459
+ def func_1(self):
460
+
461
+ st.write("test func_1")
462
+
463
+ def cs_sidebar(self):
464
+ st.write("test t")
465
+ def cs_sidebar2(self):
466
+ st.write("test t2")
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
src/Streamlit_Magic_Sheet/config/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/config/configuration.py ADDED
File without changes
src/Streamlit_Magic_Sheet/constants/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/data unboxed.png ADDED
src/Streamlit_Magic_Sheet/entity/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/entity/config_entity.py ADDED
File without changes
src/Streamlit_Magic_Sheet/pipeline/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/tests/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/utils/__init__.py ADDED
File without changes
src/Streamlit_Magic_Sheet/utils/common.py ADDED
File without changes
src/Streamlit_Magic_Sheet/utils/utils.py ADDED
File without changes