-
Notifications
You must be signed in to change notification settings - Fork 0
/
๐ _Home.py
286 lines (246 loc) ยท 8.2 KB
/
๐ _Home.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
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
import streamlit as st
st.set_page_config(page_title="TuringContent-Home", page_icon="๐ ")
import numpy as np
import streamlit as st
import numpy as np
# This code is different for each deployed app.
CURRENT_THEME = "dark"
IS_DARK_THEME = True
EXPANDER_TEXT = """
This is Streamlit's default *Dark* theme. You can enable it in the app menu
(โฐ -> Settings -> Theme) or by copying the following code to
`.streamlit/config.toml`:
```python
[theme]
base="dark"
primaryColor="#835eed"
backgroundColor = "#0e1117"
secondaryBackgroundColor = "#31333F"
textColor = "#fafafa"
font = "sans serif"
```
"""
from PIL import Image
home_image = Image.open('23.png')
st.markdown("""
# Turing
## :violet[Reinvent Education with Technology]
---
""")
st.markdown("""
### Keyword
#### :violet[๐ ์ํ ์ ๋ฌธ ๐ Interactive ๐ ์ํ์๋น์ค ๐ New Technology]
---
### Brand Slogan
### :violet[์ํ์ด ๊ณ ๋ฏผ๋ ๋, ์ํ๋์]
""")
def intro():
import streamlit as st
image = Image.open('Untitled.png')
col1, col2 = st.columns([1,5], gap="small")
with col1:
st.image(image, width=100)
with col2:
st.write("# ํ๋ง ์ฝํ
์ธ ํ ๋ธ๋ก๊ทธ")
st.markdown("""
ํ๋ง ์ฝํ
์ธ ํ ๋ธ๋ก๊ทธ์
๋๋ค.
""")
def Info():
import streamlit as st
# import pandas as pd
# import pydeck as pdk
from PIL import Image
image = Image.open('Untitled.png')
col1, col2 = st.columns([1, 5], gap="small")
with col1:
st.image(image, width=100)
with col2:
st.write("# ํ๋ง ์ฝํ
์ธ ํ ๋ธ๋ก๊ทธ")
tab1, tab2, tab3 = st.tabs(["Info", "Vision", "Contact"])
with tab1:
st.header("A cat")
st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
with tab2:
st.header("A dog")
st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
with tab3:
st.header("An owl")
st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
#
# from urllib.error import URLError
#
# st.markdown(f"# {list(page_names_to_funcs.keys())[2]}")
# st.write(
# """
# This demo shows how to use
# [`st.pydeck_chart`](https://docs.streamlit.io/library/api-reference/charts/st.pydeck_chart)
# to display geospatial data.
# """
# )
#
# @st.cache
# def from_data_file(filename):
# url = (
# "http://raw.githubusercontent.com/streamlit/"
# "example-data/master/hello/v1/%s" % filename
# )
# return pd.read_json(url)
#
# try:
# ALL_LAYERS = {
# "Bike Rentals": pdk.Layer(
# "HexagonLayer",
# data=from_data_file("bike_rental_stats.json"),
# get_position=["lon", "lat"],
# radius=200,
# elevation_scale=4,
# elevation_range=[0, 1000],
# extruded=True,
# ),
# "Bart Stop Exits": pdk.Layer(
# "ScatterplotLayer",
# data=from_data_file("bart_stop_stats.json"),
# get_position=["lon", "lat"],
# get_color=[200, 30, 0, 160],
# get_radius="[exits]",
# radius_scale=0.05,
# ),
# "Bart Stop Names": pdk.Layer(
# "TextLayer",
# data=from_data_file("bart_stop_stats.json"),
# get_position=["lon", "lat"],
# get_text="name",
# get_color=[0, 0, 0, 200],
# get_size=15,
# get_alignment_baseline="'bottom'",
# ),
# "Outbound Flow": pdk.Layer(
# "ArcLayer",
# data=from_data_file("bart_path_stats.json"),
# get_source_position=["lon", "lat"],
# get_target_position=["lon2", "lat2"],
# get_source_color=[200, 30, 0, 160],
# get_target_color=[200, 30, 0, 160],
# auto_highlight=True,
# width_scale=0.0001,
# get_width="outbound",
# width_min_pixels=3,
# width_max_pixels=30,
# ),
# }
# st.sidebar.markdown("### Map Layers")
# selected_layers = [
# layer
# for layer_name, layer in ALL_LAYERS.items()
# if st.sidebar.checkbox(layer_name, True)
# ]
# if selected_layers:
# st.pydeck_chart(
# pdk.Deck(
# map_style="mapbox://styles/mapbox/light-v9",
# initial_view_state={
# "latitude": 37.76,
# "longitude": -122.4,
# "zoom": 11,
# "pitch": 50,
# },
# layers=selected_layers,
# )
# )
# else:
# st.error("Please choose at least one layer above.")
# except URLError as e:
# st.error(
# """
# **This demo requires internet access.**
#
# Connection error: %s
# """
# % e.reason
# )
def plotting_demo():
import streamlit as st
import time
import numpy as np
st.markdown(f'# {list(page_names_to_funcs.keys())[1]}')
st.write(
"""
This demo illustrates a combination of plotting and animation with
Streamlit. We're generating a bunch of random numbers in a loop for around
5 seconds. Enjoy!
"""
)
progress_bar = st.sidebar.progress(0)
status_text = st.sidebar.empty()
last_rows = np.random.randn(1, 1)
chart = st.line_chart(last_rows)
for i in range(1, 101):
new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0)
status_text.text("%i%% Complete" % i)
chart.add_rows(new_rows)
progress_bar.progress(i)
last_rows = new_rows
time.sleep(0.05)
progress_bar.empty()
# Streamlit widgets automatically run the script from top to bottom. Since
# this button is not connected to any other logic, it just causes a plain
# rerun.
st.button("Re-run")
def data_frame_demo():
import streamlit as st
import pandas as pd
import altair as alt
from urllib.error import URLError
st.markdown(f"# {list(page_names_to_funcs.keys())[3]}")
st.write(
"""
This demo shows how to use `st.write` to visualize Pandas DataFrames.
(Data courtesy of the [UN Data Explorer](http://data.un.org/Explorer.aspx).)
"""
)
@st.cache
def get_UN_data():
AWS_BUCKET_URL = "http://streamlit-demo-data.s3-us-west-2.amazonaws.com"
df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz")
return df.set_index("Region")
try:
df = get_UN_data()
countries = st.multiselect(
"Choose countries", list(df.index), ["China", "United States of America"]
)
if not countries:
st.error("Please select at least one country.")
else:
data = df.loc[countries]
data /= 1000000.0
st.write("### Gross Agricultural Production ($B)", data.sort_index())
data = data.T.reset_index()
data = pd.melt(data, id_vars=["index"]).rename(
columns={"index": "year", "value": "Gross Agricultural Product ($B)"}
)
chart = (
alt.Chart(data)
.mark_area(opacity=0.3)
.encode(
x="year:T",
y=alt.Y("Gross Agricultural Product ($B):Q", stack=None),
color="Region:N",
)
)
st.altair_chart(chart, use_container_width=True)
except URLError as e:
st.error(
"""
**This demo requires internet access.**
Connection error: %s
"""
% e.reason
)
# page_names_to_funcs = {
# "์๋
ํ์ธ์" : intro,
# "๋ฐ๊ฐ์ต๋๋ค": Info,
# "๋์์ฃผ์ธ์": intro,
# "๊ฐ์ฌํฉ๋๋ค": intro
# }
# demo_name = st.sidebar.selectbox("ํ๋ง ์ฝํ
์ธ ํ ๋ธ๋ก๊ทธ", page_names_to_funcs.keys())
# page_names_to_funcs[demo_name]()