yuanjie commited on
Commit
a18878f
1 Parent(s): dfe3c39
.streamlit/config.toml ADDED
File without changes
AppZoo.py → _👋_.py RENAMED
File without changes
data/airline-safety.csv ADDED
@@ -0,0 +1 @@
 
 
1
+ airline,avail_seat_km_per_week,incidents_85_99,fatal_accidents_85_99,fatalities_85_99,incidents_00_14,fatal_accidents_00_14,fatalities_00_14
pages/2_📚_PDF预览.py CHANGED
@@ -11,14 +11,36 @@ class MyPage(Page):
11
 
12
  def main(self):
13
  with st.form("PDF"):
14
- file = st.file_uploader("选择待上传的PDF文件", type=['pdf'])
15
 
16
  if st.form_submit_button('开始预览', help='先上传文件!!!'):
17
  if file is not None:
18
  base64_pdf = base64.b64encode(file.read()).decode('utf-8')
19
- pdf_display = f"""<embed src="data:application/pdf;base64,{base64_pdf}" width="100%" height="800" type="application/pdf">"""
20
- st.markdown(pdf_display, unsafe_allow_html=True)
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  if __name__ == '__main__':
24
  app_title = "# PDF应用"
 
11
 
12
  def main(self):
13
  with st.form("PDF"):
14
+ file = st.file_uploader("选择待上传的PDF文件", type=['pdf', 'docx', 'xlsx'])
15
 
16
  if st.form_submit_button('开始预览', help='先上传文件!!!'):
17
  if file is not None:
18
  base64_pdf = base64.b64encode(file.read()).decode('utf-8')
 
 
19
 
20
+ self.display_pdf(base64_pdf, width='100%', height=1000)
21
+ self.display_html()
22
+
23
+ def display_pdf(self, base64_pdf, width='100%', height=1000):
24
+ # https://blog.51cto.com/laok8/2395498
25
+ pdf_display = f"""<embed src="data:application/pdf;base64,{base64_pdf}" width="{width}" height="{height}" type="application/pdf">"""
26
+ # data_type = 'vnd.openxmlformats-officedocument.wordprocessingml.document'
27
+ # pdf_display = f"""<embed src="data:application/{data_type};base64,{base64_pdf}" width="{width}" height="{height}" type="application/{data_type}">"""
28
+
29
+ st.markdown(pdf_display, unsafe_allow_html=True)
30
+
31
+ def display_html(self, text='会飞的文字'):
32
+ _ = f"""
33
+ <marquee direction="down" width="100%" height="100%" behavior="alternate" style="border:solid" bgcolor="#00FF00">
34
+
35
+ <marquee behavior="alternate">
36
+
37
+ {text}
38
+
39
+ </marquee>
40
+
41
+ </marquee>
42
+ """
43
+ st.markdown(_, unsafe_allow_html=True)
44
 
45
  if __name__ == '__main__':
46
  app_title = "# PDF应用"
pages/3_🏙_模型生成代码.py DELETED
@@ -1,56 +0,0 @@
1
- from meutils.pipe import *
2
- from appzoo.streamlit_app import Page
3
-
4
- import m2cgen as m2c
5
- import streamlit as st
6
-
7
-
8
- class MyPage(Page):
9
-
10
- def main(self):
11
- with st.form("Coding"):
12
- file = st.file_uploader('上传默模型文件')
13
- if file:
14
- estimator = joblib.load(file)
15
- else:
16
- estimator = joblib.load(get_resolve_path('../data/lr.pkl', __file__))
17
-
18
- languages = [
19
- 'python',
20
- 'java',
21
- 'go',
22
- 'c',
23
- 'c_sharp',
24
- 'r',
25
- 'dart',
26
- 'elixir',
27
- 'f_sharp',
28
- 'haskell',
29
- 'javascript',
30
- 'php',
31
- 'powershell',
32
- 'ruby',
33
- 'rust',
34
- 'visual_basi'
35
- ]
36
-
37
- _ = st.selectbox('选择输出语言', languages)
38
-
39
- if st.form_submit_button('开始转换'):
40
- code = m2c.__getattribute__(f'export_to_{_}')(estimator)
41
-
42
- st.markdown("##### code:")
43
- st.code(code)
44
-
45
-
46
-
47
- if __name__ == '__main__':
48
- app_title = "ModelToCode"
49
- app_info = """
50
- 将训练过的统计模型转化为本地代码(`Python, C, Java, Go, JavaScript, Visual Basic, c#, PowerShell, R, PHP, Dart, Haskell, Ruby, f#, Rust, Elixir`)。
51
- """
52
- MyPage(
53
- app_title=f"# {app_title}",
54
- app_info=f"> {app_info}",
55
- sidebar_title=None,
56
- ).main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/66_🔥_ASCII字符画.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from numpy import load
3
+ from numpy import expand_dims
4
+ from matplotlib import pyplot
5
+ from PIL import Image, ImageDraw, ImageFont, ImageFile
6
+ import numpy as np
7
+ import os
8
+
9
+ st.set_page_config(page_title='ASCII字符画生成器', page_icon="🅰", layout="wide")
10
+
11
+ st.header("上传一张图片生成ASCII字符画")
12
+
13
+ ImageFile.LOAD_TRUNCATED_IMAGES = True
14
+ Image.MAX_IMAGE_PIXELS = None
15
+
16
+ color_fornt = st.sidebar.color_picker('选择前景色', '#00b8e6')
17
+ color_background = st.sidebar.color_picker('选择背景色', '#ffffff')
18
+
19
+ sc_control = st.sidebar.slider('选择密度参数1', 0.1, 0.9, 0.5, 0.1)
20
+ gcf_control = st.sidebar.slider('选择密度参数2', 0.5, 4.5, 2.1, 0.1)
21
+
22
+ uploaded_file = st.file_uploader("选择一张图片", type=["png", "jpg", "bmp", "jpeg"])
23
+
24
+
25
+ @st.cache()
26
+ def asciiart(in_f, SC, GCF, out_f, bgcolor=color_background):
27
+ chars = np.asarray(list(' .,:irs?@9B&#*$%!~'))
28
+
29
+ font = ImageFont.load_default()
30
+ letter_width = font.getsize("x")[0]
31
+ letter_height = font.getsize("x")[1]
32
+ WCF = letter_height / letter_width
33
+ img = Image.open(in_f)
34
+ widthByLetter = round(img.size[0] * SC * WCF)
35
+ heightByLetter = round(img.size[1] * SC)
36
+ S = (widthByLetter, heightByLetter)
37
+ img = img.resize(S)
38
+ img = np.sum(np.asarray(img), axis=2)
39
+ img -= img.min()
40
+ img = (1.0 - img / img.max()) ** GCF * (chars.size - 1)
41
+ lines = ("\n".join(("".join(r) for r in chars[img.astype(int)]))).split("\n")
42
+ nbins = len(lines)
43
+ newImg_width = letter_width * widthByLetter
44
+ newImg_height = letter_height * heightByLetter
45
+ newImg = Image.new("RGBA", (newImg_width, newImg_height), bgcolor)
46
+ draw = ImageDraw.Draw(newImg)
47
+ leftpadding = 0
48
+ y = 0
49
+ lineIdx = 0
50
+
51
+ for line in lines:
52
+ color = color_fornt
53
+ lineIdx += 1
54
+ draw.text((leftpadding, y), line, color, font=font)
55
+ y += letter_height
56
+
57
+ newImg.save(out_f)
58
+
59
+
60
+ @st.cache()
61
+ def load_image(filename, size=(512, 512)):
62
+ pixels = load_img(filename, target_size=size)
63
+ pixels = img_to_array(pixels)
64
+ pixels = (pixels - 127.5) / 127.5
65
+ pixels = expand_dims(pixels, 0)
66
+ return pixels
67
+
68
+
69
+ @st.cache()
70
+ def imgGen2(img1):
71
+ inputf = img1
72
+ SC = sc_control
73
+ GCF = gcf_control
74
+ asciiart(inputf, SC, GCF, "results.png", color_background)
75
+ img = Image.open(img1)
76
+ img2 = Image.open('results.png').resize(img.size)
77
+
78
+ return img2
79
+
80
+
81
+ # 下载按钮效果设置
82
+ css = """<style>
83
+ .stDownloadButton>button {
84
+ background-color: #0099ff;
85
+ color:#ffffff;
86
+ }
87
+
88
+ .stDownloadButton>button:hover {
89
+ background-color: green;
90
+ color:white;
91
+ }
92
+ </style>
93
+ """
94
+ st.markdown(css, unsafe_allow_html=True)
95
+
96
+ if uploaded_file is not None:
97
+ st.sidebar.image(uploaded_file, caption='原始图片', use_column_width=True)
98
+ im = imgGen2(uploaded_file)
99
+ st.image(im, width=700)
100
+ with open("results.png", "rb") as file:
101
+ # st.image("图片.jpg")
102
+ btn = st.download_button(
103
+ label="点我下载生成的ASCII字符画",
104
+ data=file,
105
+ file_name="ASCII字符画.png",
106
+ mime="image/png"
107
+ )
pages/66_🔥_Torch.py DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # @Project : Python.
4
- # @File : 4_🔥_Torch
5
- # @Time : 2022/9/23 上午11:40
6
- # @Author : yuanjie
7
- # @WeChat : meutils
8
- # @Software : PyCharm
9
- # @Description :
10
-
11
-
12
- import streamlit as st
13
- from transformers import pipeline
14
- from PIL import Image
15
-
16
- pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
17
-
18
- st.title("Hot Dog? Or Not?")
19
-
20
- file_name = st.file_uploader("Upload a hot dog candidate image")
21
-
22
- if file_name is not None:
23
- col1, col2 = st.columns(2)
24
-
25
- image = Image.open(file_name)
26
- col1.image(image, use_column_width=True)
27
- predictions = pipeline(image)
28
-
29
- col2.header("Probabilities")
30
- for p in predictions:
31
- col2.subheader(f"{p['label']}: {round(p['score'] * 100, 1)}%")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/888_🌰_demo.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from urllib.parse import urlencode, parse_qs
2
+ import streamlit as st
3
+
4
+ initial_query_params = st.session_state.get("initial_query_params")
5
+ query_params = {k: v[0] for k, v in st.experimental_get_query_params().items()}
6
+ if not initial_query_params:
7
+ initial_query_params = query_params.copy()
8
+ st.session_state["initial_query_params"] = initial_query_params.copy()
9
+
10
+ st.write("Initial query params of the session:", initial_query_params)
11
+ st.write("Query params before setting new ones:", query_params)
12
+
13
+ new_query_string = st.text_area("New query params string (like 'a=b&c=d')", value=urlencode(initial_query_params))
14
+ if st.button("Set new query params without starting new session"):
15
+ st.experimental_set_query_params(**parse_qs(new_query_string))
16
+
17
+ with st.sidebar:
18
+ st.markdown("---")
19
+ st.markdown(
20
+ '<h6>Made in &nbsp<img src="https://streamlit.io/images/brand/streamlit-mark-color.png" alt="Streamlit logo" height="16">&nbsp by <a href="https://twitter.com/andfanilo">@andfanilo</a></h6>',
21
+ unsafe_allow_html=True,
22
+ )
23
+ st.markdown(
24
+ '<div style="margin-top: 0.75em;"><a href="https://www.buymeacoffee.com/andfanilo" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a></div>',
25
+ unsafe_allow_html=True,
26
+ )
pages/990_streamlit_autorefresh.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from streamlit_autorefresh import st_autorefresh
3
+
4
+ # Run the autorefresh about every 2000 milliseconds (2 seconds) and stop
5
+ # after it's been refreshed 100 times.
6
+ count = st_autorefresh(interval=2000, limit=100, key="fizzbuzzcounter")
7
+
8
+ # The function returns a counter for number of refreshes. This allows the
9
+ # ability to make special requests at different intervals based on the count
10
+ if count == 0:
11
+ st.write("Count is zero")
12
+ elif count % 3 == 0 and count % 5 == 0:
13
+ st.write("FizzBuzz")
14
+ elif count % 3 == 0:
15
+ st.write("Fizz")
16
+ elif count % 5 == 0:
17
+ st.write("Buzz")
18
+ else:
19
+ st.write(f"Count: {count}")
pages/991_streamlit_apex_charts.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : 991_streamlit_apex_charts
5
+ # @Time : 2022/10/17 上午10:48
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+
12
+ import psutil
13
+ import streamlit as st
14
+ import time
15
+ import datetime
16
+ from streamlit_autorefresh import st_autorefresh
17
+ from streamlit_apex_charts import bar_chart, pie_chart
18
+ import pandas as pd
19
+ import platform
20
+ import os
21
+
22
+
23
+ st.set_page_config(page_title="系统信息查看器", page_icon="💻", layout="wide")
24
+
25
+ #st_autorefresh(interval=5000, limit=100000, key="Mr.R")
26
+
27
+ st.header("系统信息查看器")
28
+ base_infor = [[datetime.datetime.now().strftime("%Y-%m-%d %H: %M: %S"),str(psutil.users()[0][0]),platform.platform()]]
29
+ df_base_infor = pd.DataFrame(base_infor, columns=["当前时间","登陆者","操作系统"])
30
+ st.table(df_base_infor)
31
+
32
+ #获取网卡名称
33
+ def get_key():
34
+ key_info = psutil.net_io_counters(pernic=True).keys() # 获取网卡名称
35
+ recv = {}
36
+ sent = {}
37
+ for key in key_info:
38
+ recv.setdefault(key, psutil.net_io_counters(pernic=True).get(key).bytes_recv) # 各网卡接收的字节数
39
+ sent.setdefault(key, psutil.net_io_counters(pernic=True).get(key).bytes_sent) # 各网卡发送的字节数
40
+ return key_info, recv, sent
41
+
42
+ #获取网卡速率
43
+ def get_rate(func):
44
+ key_info, old_recv, old_sent = func() # 上一秒收集的数据
45
+ time.sleep(1)
46
+ key_info, now_recv, now_sent = func() # 当前所收集的数据
47
+ net_in = {}
48
+ net_out = {}
49
+ for key in key_info:
50
+ net_in.setdefault(key, (now_recv.get(key) - old_recv.get(key)) / 1024) # 每秒接收速率
51
+ net_out.setdefault(key, (now_sent.get(key) - old_sent.get(key)) / 1024) # 每秒发送速率
52
+ return key_info, net_in, net_out
53
+
54
+
55
+ c1, c2, c3 = st.columns(3)
56
+
57
+ with c1:
58
+ #内存
59
+ mem = psutil.virtual_memory()
60
+ zj = float(mem.total) / 1024 / 1024 / 1024
61
+ ysy = float(mem.used) / 1024 / 1024 / 1024
62
+ kx = float(mem.free) / 1024 / 1024 / 1024
63
+
64
+ data_neicun = [[round(ysy,2),round(kx, 2)]]
65
+ df_neicun = pd.DataFrame(data_neicun, columns=["已用内存","空闲内存"])
66
+ pie_chart("内存使用情况(GB)", df_neicun)
67
+
68
+
69
+ #CPU
70
+ cpu_liyonglv = (str(psutil.cpu_percent(1))) + '%'
71
+ cpu_data = [[cpu_liyonglv]]
72
+ df_cpu = pd.DataFrame(cpu_data, columns=["CPU利用率"])
73
+ bar_chart("CPU利用率(%)", df_cpu)
74
+
75
+ with c2:
76
+ #磁盘
77
+ dk = psutil.disk_usage('/')
78
+ total = dk.total / 1024 / 1024 / 1024
79
+ used = dk.used / 1024 / 1024 / 1024
80
+ free = dk.free / 1024 / 1024 / 1024
81
+
82
+ cipan_shiyong = [[used, free]]
83
+ df_cipan = pd.DataFrame(cipan_shiyong, columns=["已使用磁盘大小","空闲磁盘大小"])
84
+ pie_chart("磁盘使用率(%)", df_cipan)
85
+
86
+ #网络速率
87
+ key_info, net_in, net_out = get_rate(get_key)
88
+ wangka_liuliang = []
89
+ for key in key_info:
90
+ wangka_liuliang.append([net_in.get(key),net_out.get(key)])
91
+ speed_internet = wangka_liuliang
92
+ df_speed = pd.DataFrame(speed_internet, columns=["下行速率","上行速率"])
93
+ bar_chart("网络速率(kb/s)", df_speed)
94
+
95
+
96
+
97
+ with c3:
98
+ #进程信息
99
+ pids = psutil.pids()
100
+ process = []
101
+ for pid in pids:
102
+ p = psutil.Process(pid)
103
+ process_name = p.name()
104
+ process.append([pid, process_name, p.is_running()])
105
+
106
+ df_process = pd.DataFrame(process, columns=["PID","进程名","是否还在运行"])
107
+ st.dataframe(df_process)
108
+
109
+ # #已安装软件
110
+ # import wmi
111
+ # c = wmi.WMI()
112
+ # software_list = []
113
+ # for s in c.Win32_Product():
114
+ # software_list.append([s.Caption, s.Vendor, s.Version])
115
+ # if len(software_list)>1:
116
+ # st.dataframe(pd.DataFrame(software_list, columns=["名称","发布人","版本"]))
117
+ # else:
118
+ # st.info("正在导出已安装的软件程序列表")
pages/992_streamlit_chat.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : 991_streamlit_apex_charts
5
+ # @Time : 2022/10/17 上午10:48
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+ import streamlit as st
11
+ from streamlit_chat import message
12
+
13
+ message_history = ["展示信息"]
14
+
15
+ for message_ in message_history:
16
+ message(message_) # display all the previous message
17
+
18
+ placeholder = st.empty() # placeholder for latest message
19
+ input_ = st.text_input("you:")
20
+ message_history.append(input_)
21
+
22
+ with placeholder.container():
23
+ message(message_history[-1], ) # display the latest message
24
+ message(message_history[-1], is_user=True) # align's the message to the right
pages/993_streamlit_text_rating.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from streamlit_text_rating.st_text_rater import st_text_rater
2
+
3
+
4
+ import streamlit as st
5
+
6
+
7
+ st.title("Awesome App")
8
+ for text in ["Is this text helpful?", "Do you like this text?"]:
9
+ response = st_text_rater(text=text)
10
+ st.write(f"response --> {response}")
11
+
pages/994_自定义style.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : 994_自定义style
5
+ # @Time : 2022/10/17 上午11:45
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+
12
+ import streamlit as st
13
+ from streamlit.components.v1 import html
14
+
15
+ st.button('button背景色?换一个吧')
16
+ st.text_area('del', placeholder='Label多余?删了就好')
17
+ st.radio('想放大label字号, 修改字体吗?', ['想', '很想'])
18
+
19
+ st.markdown('''<style>
20
+ /* radio label字号、字体 */
21
+ #root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(3) > div > label {
22
+ font-size: 50px;
23
+ font-family: "Times New Roman", serif;
24
+ }
25
+ /* button背景色 */
26
+ #root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(1) > div > button {
27
+ background-color: black;
28
+ color: white;
29
+ }
30
+ /* radio选中项颜色 */
31
+ #root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(3) > div > div > label:nth-child(1) > div.st-co.st-cs.st-ct.st-cu.st-cv.st-cw.st-az.st-b4.st-cx.st-cy.st-cz.st-d0.st-d1.st-d2.st-c4.st-d3.st-d4.st-d5.st-b2.st-bl {
32
+ background-color: black;
33
+ }
34
+ </style>''', unsafe_allow_html=True)
35
+
36
+ js_delete = '''window.parent.document.querySelector("#root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(2) > div > label").remove()'''
37
+ html(f'''<script>{js_delete}</script>''',
38
+ width=0,
39
+ height=0)
pages/995_streamlit_echarts.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : 995_streamlit_echarts
5
+ # @Time : 2022/10/17 下午12:11
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+
12
+ from streamlit_echarts import st_echarts
13
+
14
+ options = {
15
+ "xAxis": {
16
+ "type": "category",
17
+ "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
18
+ },
19
+ "yAxis": {"type": "value"},
20
+ "series": [
21
+ {"data": [820, 932, 901, 934, 1290, 1330, 1320], "type": "line"}
22
+ ],
23
+ }
24
+ st_echarts(options=options)
25
+
pages/996_streamlit_pyecharts.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : 995_streamlit_echarts
5
+ # @Time : 2022/10/17 下午12:11
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from pyecharts import options as opts
12
+ from pyecharts.charts import Bar, WordCloud
13
+ from streamlit_echarts import st_pyecharts
14
+ import streamlit as st
15
+
16
+ tab1, tab2, tab3 = st.tabs(["Bar", "WordCloud", "Owl"])
17
+
18
+ with tab1:
19
+ b = (
20
+ Bar()
21
+ .add_xaxis(["Microsoft", "Amazon", "IBM", "Oracle", "Google", "Alibaba"])
22
+ .add_yaxis(
23
+ "2017-2018 Revenue in (billion $)", [21.2, 20.4, 10.3, 6.08, 4, 2.2]
24
+ )
25
+ .set_global_opts(
26
+ title_opts=opts.TitleOpts(
27
+ title="Top cloud providers 2018", subtitle="2017-2018 Revenue"
28
+ ),
29
+ toolbox_opts=opts.ToolboxOpts(),
30
+ )
31
+ )
32
+ st_pyecharts(b)
33
+
34
+ with tab2:
35
+
36
+ pairs = [('中国', 33),
37
+ ('苹果', 24),
38
+ ('奚梦瑶', 20),
39
+ ('美国', 16),
40
+ ('特朗普', 16),
41
+ ('何猷君', 15),
42
+ ('戛纳', 13),
43
+ ('红毯', 12),
44
+ ('iPhone', 12),
45
+ ('车队', 9),
46
+ ('车祸', 9),
47
+ ('优衣', 9),
48
+ ('信息', 9),
49
+ ('李亚鹏', 9),
50
+ ('恋情', 9),
51
+ ('任素', 9),
52
+ ('男孩', 9),
53
+ ('亚洲', 8),
54
+ ('孩子', 8),
55
+ ('大学生', 8)]
56
+ shapes = ['circle', 'cardioid', 'diamond', 'triangle-forward', 'triangle', 'pentagon', 'star']
57
+
58
+ wc = (
59
+ WordCloud()
60
+ .add("WordCloud", data_pair=pairs, shape=shapes[0], width='900px', height='500px')
61
+
62
+ .set_global_opts(
63
+ title_opts=opts.TitleOpts(
64
+ title="WordCloud", subtitle="WordCloud"
65
+ ),
66
+ toolbox_opts=opts.ToolboxOpts(),
67
+ )
68
+ )
69
+
70
+ st_pyecharts(wc)
requirements.txt CHANGED
@@ -1,4 +1,11 @@
1
  meutils
2
  appzoo
 
 
3
 
4
- m2cgen
 
 
 
 
 
 
1
  meutils
2
  appzoo
3
+ pyecharts
4
+ m2cgen
5
 
6
+ # streamlit
7
+ streamlit_autorefresh
8
+ streamlit_apex_charts
9
+ streamlit_chat
10
+ streamlit_text_rating
11
+ streamlit_echarts
result.txt DELETED
The diff for this file is too large to render. See raw diff
 
run.sh CHANGED
@@ -6,5 +6,9 @@
6
  # @Software : PyCharm
7
  # @Description : ${DESCRIPTION}
8
 
9
- streamlit run AppZoo.py
10
 
 
 
 
 
 
6
  # @Software : PyCharm
7
  # @Description : ${DESCRIPTION}
8
 
9
+ streamlit run _👋_.py
10
 
11
+ #from streamlit import bootstrap
12
+ #
13
+ #st._is_running_with_streamlit = True
14
+ #bootstrap.run(__file__, 'streamlit run', [], {})
x.html ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid" bgcolor="#00FF00">
2
+
3
+ <marquee behavior="alternate">
4
+
5
+ 会飞的文字
6
+
7
+ </marquee>
8
+
9
+ </marquee>