'a'
Browse files- .gitignore +6 -0
- aaa.yml +126 -0
- app.py +127 -0
- dataup/base.csv +39 -0
- dataup/chinese_unicode_table.txt +0 -0
- requirments.txt +80 -0
- streamlit_te.py +119 -0
.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.pyc
|
2 |
+
*.jpeg
|
3 |
+
/flagged/
|
4 |
+
*.jpg
|
5 |
+
*.png
|
6 |
+
*.gif
|
aaa.yml
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: stlit
|
2 |
+
channels:
|
3 |
+
- https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge
|
4 |
+
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
|
5 |
+
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
|
6 |
+
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
|
7 |
+
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
|
8 |
+
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
|
9 |
+
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
|
10 |
+
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
|
11 |
+
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
|
12 |
+
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r/
|
13 |
+
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
|
14 |
+
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
|
15 |
+
- https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
|
16 |
+
- https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
|
17 |
+
- https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
|
18 |
+
- https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
|
19 |
+
- https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
|
20 |
+
- defaults
|
21 |
+
dependencies:
|
22 |
+
- ca-certificates=2021.10.8=h5b45459_0
|
23 |
+
- openssl=3.0.2=h8ffe710_1
|
24 |
+
- pip=22.0.4=pyhd8ed1ab_0
|
25 |
+
- python=3.7.12=h900ac77_100_cpython
|
26 |
+
- python_abi=3.7=2_cp37m
|
27 |
+
- setuptools=61.1.1=py37h03978a9_0
|
28 |
+
- sqlite=3.37.1=h8ffe710_0
|
29 |
+
- ucrt=10.0.20348.0=h57928b3_0
|
30 |
+
- vc=14.2=hb210afc_6
|
31 |
+
- vs2015_runtime=14.29.30037=h902a5da_6
|
32 |
+
- wheel=0.37.1=pyhd8ed1ab_0
|
33 |
+
- pip:
|
34 |
+
- altair==4.2.0
|
35 |
+
- argon2-cffi==21.3.0
|
36 |
+
- argon2-cffi-bindings==21.2.0
|
37 |
+
- attrs==21.4.0
|
38 |
+
- backcall==0.2.0
|
39 |
+
- backports-zoneinfo==0.2.1
|
40 |
+
- beautifulsoup4==4.10.0
|
41 |
+
- bleach==4.1.0
|
42 |
+
- blinker==1.4
|
43 |
+
- cachetools==5.0.0
|
44 |
+
- certifi==2021.10.8
|
45 |
+
- cffi==1.15.0
|
46 |
+
- charset-normalizer==2.0.12
|
47 |
+
- click==8.0.4
|
48 |
+
- colorama==0.4.4
|
49 |
+
- debugpy==1.6.0
|
50 |
+
- decorator==5.1.1
|
51 |
+
- defusedxml==0.7.1
|
52 |
+
- entrypoints==0.4
|
53 |
+
- gitdb==4.0.9
|
54 |
+
- gitpython==3.1.27
|
55 |
+
- idna==3.3
|
56 |
+
- importlib-metadata==4.11.3
|
57 |
+
- importlib-resources==5.6.0
|
58 |
+
- ipykernel==6.9.2
|
59 |
+
- ipython==7.32.0
|
60 |
+
- ipython-genutils==0.2.0
|
61 |
+
- ipywidgets==7.7.0
|
62 |
+
- jedi==0.18.1
|
63 |
+
- jinja2==3.1.1
|
64 |
+
- jsonschema==4.4.0
|
65 |
+
- jupyter-client==7.1.2
|
66 |
+
- jupyter-core==4.9.2
|
67 |
+
- jupyterlab-pygments==0.1.2
|
68 |
+
- jupyterlab-widgets==1.1.0
|
69 |
+
- markupsafe==2.1.1
|
70 |
+
- matplotlib-inline==0.1.3
|
71 |
+
- mistune==0.8.4
|
72 |
+
- nbclient==0.5.13
|
73 |
+
- nbconvert==6.4.4
|
74 |
+
- nbformat==5.2.0
|
75 |
+
- nest-asyncio==1.5.4
|
76 |
+
- notebook==6.4.10
|
77 |
+
- numpy==1.21.5
|
78 |
+
- packaging==21.3
|
79 |
+
- pandas==1.3.5
|
80 |
+
- pandocfilters==1.5.0
|
81 |
+
- parso==0.8.3
|
82 |
+
- pickleshare==0.7.5
|
83 |
+
- pillow==9.0.1
|
84 |
+
- plotly==5.6.0
|
85 |
+
- prometheus-client==0.13.1
|
86 |
+
- prompt-toolkit==3.0.28
|
87 |
+
- protobuf==3.19.4
|
88 |
+
- psutil==5.9.0
|
89 |
+
- pyarrow==7.0.0
|
90 |
+
- pycparser==2.21
|
91 |
+
- pydeck==0.7.1
|
92 |
+
- pygments==2.11.2
|
93 |
+
- pympler==1.0.1
|
94 |
+
- pyparsing==3.0.7
|
95 |
+
- pyrsistent==0.18.1
|
96 |
+
- python-dateutil==2.8.2
|
97 |
+
- pytz==2022.1
|
98 |
+
- pytz-deprecation-shim==0.1.0.post0
|
99 |
+
- pywin32==303
|
100 |
+
- pywinpty==2.0.5
|
101 |
+
- pyzmq==22.3.0
|
102 |
+
- requests==2.27.1
|
103 |
+
- semver==2.13.0
|
104 |
+
- send2trash==1.8.0
|
105 |
+
- six==1.16.0
|
106 |
+
- smmap==5.0.0
|
107 |
+
- soupsieve==2.3.1
|
108 |
+
- streamlit==1.8.0
|
109 |
+
- tenacity==8.0.1
|
110 |
+
- terminado==0.13.3
|
111 |
+
- testpath==0.6.0
|
112 |
+
- toml==0.10.2
|
113 |
+
- toolz==0.11.2
|
114 |
+
- tornado==6.1
|
115 |
+
- traitlets==5.1.1
|
116 |
+
- typing-extensions==4.1.1
|
117 |
+
- tzdata==2022.1
|
118 |
+
- tzlocal==4.1
|
119 |
+
- urllib3==1.26.9
|
120 |
+
- validators==0.18.2
|
121 |
+
- watchdog==2.1.7
|
122 |
+
- wcwidth==0.2.5
|
123 |
+
- webencodings==0.5.1
|
124 |
+
- widgetsnbextension==3.6.0
|
125 |
+
- zipp==3.7.0
|
126 |
+
prefix: C:\Users\dscshap3808\Miniconda3\envs\stlit
|
app.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import plotly.express as px
|
5 |
+
import warnings
|
6 |
+
import re
|
7 |
+
from zhdate import ZhDate as lunar_date
|
8 |
+
from typing import Iterable
|
9 |
+
import streamlit.components.v1 as components
|
10 |
+
from datetime import datetime
|
11 |
+
from PIL import Image
|
12 |
+
warnings.filterwarnings('ignore')
|
13 |
+
# import plotly.graph_objs as go
|
14 |
+
|
15 |
+
st.set_page_config(
|
16 |
+
page_title="simingyanwebpage",
|
17 |
+
page_icon="🧊",
|
18 |
+
layout="wide",
|
19 |
+
initial_sidebar_state="expanded",
|
20 |
+
menu_items={
|
21 |
+
'About': "fyenne@hotmail.com"
|
22 |
+
}
|
23 |
+
)
|
24 |
+
|
25 |
+
class load_data:
|
26 |
+
'''
|
27 |
+
read some data
|
28 |
+
'''
|
29 |
+
def __init__(self, df, lunar_today, pltdf):
|
30 |
+
self.df = pd.DataFrame()
|
31 |
+
self.lunar_today = ''
|
32 |
+
self.pltdf = pd.DataFrame()
|
33 |
+
self.chinese_char_map = {}
|
34 |
+
|
35 |
+
|
36 |
+
df = pd.read_csv('./dataup/base.csv')
|
37 |
+
lunar_today = re.sub('\D', '', str(lunar_date.from_datetime(datetime.now())))
|
38 |
+
pltdf = pd.DataFrame(data = {
|
39 |
+
'main': '八卦',
|
40 |
+
'wuxing':['金', '金', '火', '火', '木', '木', '土', '土','土', '土', '水', '水'],
|
41 |
+
'bagua': ['乾','兑','离','离','震','巽','坤','坤','艮','艮','坎','坎'],
|
42 |
+
'tiangan':['庚', '辛','丙', '丁', '甲', '乙', '戊', '己', '戊', '己', '壬', '癸'],
|
43 |
+
'dizhi':['申', '酉','巳', '午','寅','卯','辰','戌', '丑', '未', '亥', '子'],
|
44 |
+
'value1': np.repeat(10, 12).tolist()
|
45 |
+
})
|
46 |
+
def plt1():
|
47 |
+
fig = px.sunburst(load_data.pltdf, path=['main', 'wuxing', 'bagua', 'tiangan', 'dizhi'], values='value1',\
|
48 |
+
color_discrete_sequence = px.colors.qualitative.Pastel2[0:8]
|
49 |
+
)
|
50 |
+
return fig
|
51 |
+
|
52 |
+
def count_strokes(words: Iterable) -> int:
|
53 |
+
"""
|
54 |
+
统计字符串中所有文字的笔画总数
|
55 |
+
|
56 |
+
:param words: 需要统计的字符串
|
57 |
+
:return: 笔画总数
|
58 |
+
"""
|
59 |
+
chinese_char_map = {}
|
60 |
+
with open('./dataup/chinese_unicode_table.txt', 'r', encoding='UTF-8') as f:
|
61 |
+
lines = f.readlines()
|
62 |
+
for line in lines[6:]: # 前6行是表头,去掉
|
63 |
+
line_info = line.strip().split()
|
64 |
+
# 处理后的数组第一个是文字,第7个是笔画数量
|
65 |
+
chinese_char_map[line_info[0]] = line_info[6]
|
66 |
+
strokes = 0
|
67 |
+
for word in words:
|
68 |
+
if 0 <= ord(word) <= 126: # 数字,英文符号范围
|
69 |
+
strokes += 1
|
70 |
+
elif 0x4E00 <= ord(word) <= 0x9FA5: # 常用汉字Unicode编码范围4E00-9FA5,20902个字
|
71 |
+
strokes += int(chinese_char_map.get(word, 1))
|
72 |
+
else: # 特殊符号字符一律排在最后
|
73 |
+
strokes += 1
|
74 |
+
return strokes
|
75 |
+
|
76 |
+
|
77 |
+
st.title('正德佷准')
|
78 |
+
st.markdown('--- \n > **人工智能和量子物理结合下的优化版梅花易数**\n ---')
|
79 |
+
# ----
|
80 |
+
|
81 |
+
# # l2=[]
|
82 |
+
# # 将纵向每个字符当作 y 坐标的刻度
|
83 |
+
# for y in range(15,-15,-1):
|
84 |
+
# l3 = []
|
85 |
+
# # 将横向每个字符当作 x 坐标的刻度
|
86 |
+
# for x in range(-30,30):
|
87 |
+
# # 如果 x,y 点在心形内,则将一个字符加入到行,否则加入空字符
|
88 |
+
# l3.append((' I love U'[(x-y)%9]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' '))
|
89 |
+
# l2.append(''.join(l3))
|
90 |
+
# l1 ='\n'.join(l2)
|
91 |
+
|
92 |
+
|
93 |
+
st.text('hahha')
|
94 |
+
# ----
|
95 |
+
selected_target = st.selectbox('测什么?', options = ['选择', '情路', '仕途'])
|
96 |
+
if selected_target == '选择':
|
97 |
+
print('')
|
98 |
+
st.plotly_chart(load_data.plt1())
|
99 |
+
# -----
|
100 |
+
else:
|
101 |
+
'今日是农历: %s \
|
102 |
+
公历 %s'%(load_data.lunar_today, datetime.today().strftime('%Y%m%d'))
|
103 |
+
dizhi = '酉、戌、亥、子、丑、寅、卯、辰、巳、午、未、申'.split('、')
|
104 |
+
|
105 |
+
dict = dict(zip(range(1,13), "子、丑、寅、卯、辰、巳、午、未、申、酉、戌、亥".split('、')))
|
106 |
+
# st.code()
|
107 |
+
name = st.text_input('请输入您的姓名')
|
108 |
+
# st.text()
|
109 |
+
components.html("<html><body>笔画数:%s</body></html>"%load_data.count_strokes(name),
|
110 |
+
width=200, height=30)
|
111 |
+
|
112 |
+
bdate = st.text_input('请输入您的生日', value = '20220304')
|
113 |
+
dizhi = dizhi[int(bdate[0:4])%12 - 1]
|
114 |
+
components.html("<html><body>地支: %s</body></html>"%dizhi,
|
115 |
+
width=200, height=30)
|
116 |
+
|
117 |
+
bt = st.button('测')
|
118 |
+
if (bt == True) & (name != '') & (int(bdate) < 20220101) & (len(name) < 26):
|
119 |
+
st.markdown('恭喜您和刘亦菲谈恋爱')
|
120 |
+
else:
|
121 |
+
st.text("输入信息有误")
|
122 |
+
pass
|
123 |
+
|
124 |
+
|
125 |
+
# s2 = st.color_picker()
|
126 |
+
|
127 |
+
# s2.background_gradient(axis=None, vmin=0, vmax=1000, cmap="YlGnBu")
|
dataup/base.csv
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<<<<<<< HEAD
|
2 |
+
0,1,2,3,4,5
|
3 |
+
五行,木,火,土,金,水
|
4 |
+
八卦与五行的对应,震、巽,离,坤、艮,乾、兑,坎
|
5 |
+
十天干与五行的对应,甲、乙,丙、丁,戊、己,庚、辛,壬、癸
|
6 |
+
地支与五行的对应,寅、卯,巳、午,辰、戌、丑、未,申、酉,亥、子
|
7 |
+
四季与五行的对应,春,夏,长夏,秋,冬
|
8 |
+
方位与五行的对应,东,南,中,西,北
|
9 |
+
气候与五行的对应,风,热,湿,燥,寒
|
10 |
+
物相与五行的对应,生,长,化,收,藏
|
11 |
+
颜色与五行的对应,青、绿,赤、红,黄,白,黑
|
12 |
+
性味与五行的对应,酸,苦,甘,辛,咸
|
13 |
+
五音与五行的对应,角,徵,宫,商,羽
|
14 |
+
河图天地数与入卦的配属,3,2,5,4,1
|
15 |
+
与五体、五官、五华相通,肝,心,脾,肺,肾
|
16 |
+
“五腑”合“三焦”习称六腑,胆,小肠,胃,大肠,膀胱
|
17 |
+
源自于“五”数的伦理规范,仁,礼,信,义,智
|
18 |
+
内在情感(情志)的外显,怒,喜,思,悲,恐
|
19 |
+
精神与五脏的内在牵连,魂,神,意,魄,志
|
20 |
+
=======
|
21 |
+
0,1,2,3,4,5
|
22 |
+
五行,木,火,土,金,水
|
23 |
+
八卦与五行的对应,震、巽,离,坤、艮,乾、兑,坎
|
24 |
+
十天干与五行的对应,甲、乙,丙、丁,戊、己,庚、辛,壬、癸
|
25 |
+
地支与五行的对应,寅、卯,巳、午,辰、戌、丑、未,申、酉,亥、子
|
26 |
+
四季与五行的对应,春,夏,长夏,秋,冬
|
27 |
+
方位与五行的对应,东,南,中,西,北
|
28 |
+
气候与五行的对应,风,热,湿,燥,寒
|
29 |
+
物相与五行的对应,生,长,化,收,藏
|
30 |
+
颜色与五行的对应,青、绿,赤、红,黄,白,黑
|
31 |
+
性味与五行的对应,酸,苦,甘,辛,咸
|
32 |
+
五音与五行的对应,角,徵,宫,商,羽
|
33 |
+
河图天地数与入卦的配属,3,2,5,4,1
|
34 |
+
与五体、五官、五华相通,肝,心,脾,肺,肾
|
35 |
+
“五腑”合“三焦”习称六腑,胆,小肠,胃,大肠,膀胱
|
36 |
+
源自于“五”数的伦理规范,仁,礼,信,义,智
|
37 |
+
内在情感(情志)的外显,怒,喜,思,悲,恐
|
38 |
+
精神与五脏的内在牵连,魂,神,意,魄,志
|
39 |
+
>>>>>>> 01227678ef980a6c2bef4c0df3cae199206d27af
|
dataup/chinese_unicode_table.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
requirments.txt
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
attrs==21.4.0
|
2 |
+
backcall==0.2.0
|
3 |
+
backports.zoneinfo==0.2.1
|
4 |
+
bleach==4.1.0
|
5 |
+
blinker==1.4
|
6 |
+
cachetools==5.0.0
|
7 |
+
certifi==2021.10.8
|
8 |
+
cffi==1.15.0
|
9 |
+
charset-normalizer==2.0.12
|
10 |
+
click==8.0.4
|
11 |
+
colorama==0.4.4
|
12 |
+
debugpy==1.6.0
|
13 |
+
decorator==5.1.1
|
14 |
+
defusedxml==0.7.1
|
15 |
+
entrypoints==0.4
|
16 |
+
gitdb==4.0.9
|
17 |
+
GitPython==3.1.27
|
18 |
+
idna==3.3
|
19 |
+
importlib-metadata==4.11.3
|
20 |
+
importlib-resources==5.6.0
|
21 |
+
Jinja2==3.1.1
|
22 |
+
jsonschema==4.4.0
|
23 |
+
MarkupSafe==2.1.1
|
24 |
+
matplotlib-inline==0.1.3
|
25 |
+
mistune==0.8.4
|
26 |
+
nbclient==0.5.13
|
27 |
+
nbconvert==6.4.4
|
28 |
+
nbformat==5.2.0
|
29 |
+
nest-asyncio==1.5.4
|
30 |
+
notebook==6.4.10
|
31 |
+
numpy==1.21.5
|
32 |
+
packaging==21.3
|
33 |
+
pandas==1.3.5
|
34 |
+
pandocfilters==1.5.0
|
35 |
+
parso==0.8.3
|
36 |
+
pickleshare==0.7.5
|
37 |
+
Pillow==9.0.1
|
38 |
+
plotly==5.6.0
|
39 |
+
prometheus-client==0.13.1
|
40 |
+
prompt-toolkit==3.0.28
|
41 |
+
protobuf==3.19.4
|
42 |
+
psutil==5.9.0
|
43 |
+
pyarrow==7.0.0
|
44 |
+
pycparser==2.21
|
45 |
+
pydeck==0.7.1
|
46 |
+
Pygments==2.11.2
|
47 |
+
Pympler==1.0.1
|
48 |
+
pyparsing==3.0.7
|
49 |
+
pyrsistent==0.18.1
|
50 |
+
python-dateutil==2.8.2
|
51 |
+
pytz==2022.1
|
52 |
+
pytz-deprecation-shim==0.1.0.post0
|
53 |
+
pywin32==303
|
54 |
+
pywinpty==2.0.5
|
55 |
+
pyzmq==22.3.0
|
56 |
+
requests==2.27.1
|
57 |
+
semver==2.13.0
|
58 |
+
Send2Trash==1.8.0
|
59 |
+
six==1.16.0
|
60 |
+
smmap==5.0.0
|
61 |
+
soupsieve==2.3.1
|
62 |
+
streamlit==1.8.0
|
63 |
+
tenacity==8.0.1
|
64 |
+
terminado==0.13.3
|
65 |
+
testpath==0.6.0
|
66 |
+
toml==0.10.2
|
67 |
+
toolz==0.11.2
|
68 |
+
tornado==6.1
|
69 |
+
traitlets==5.1.1
|
70 |
+
typing_extensions==4.1.1
|
71 |
+
tzdata==2022.1
|
72 |
+
tzlocal==4.1
|
73 |
+
urllib3==1.26.9
|
74 |
+
validators==0.18.2
|
75 |
+
watchdog==2.1.7
|
76 |
+
wcwidth==0.2.5
|
77 |
+
webencodings==0.5.1
|
78 |
+
widgetsnbextension==3.6.0
|
79 |
+
zhdate==0.1
|
80 |
+
zipp==3.7.0
|
streamlit_te.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import plotly.express as px
|
5 |
+
import warnings
|
6 |
+
import re
|
7 |
+
from zhdate import ZhDate as lunar_date
|
8 |
+
from typing import Iterable
|
9 |
+
import streamlit.components.v1 as components
|
10 |
+
from datetime import datetime
|
11 |
+
# from PIL import Image
|
12 |
+
warnings.filterwarnings('ignore')
|
13 |
+
# import plotly.graph_objs as go
|
14 |
+
|
15 |
+
st.set_page_config(
|
16 |
+
page_title="正德佷准官方网站",
|
17 |
+
page_icon="🧊",
|
18 |
+
layout="wide",
|
19 |
+
initial_sidebar_state="expanded",
|
20 |
+
menu_items={
|
21 |
+
'About': "fyenne@hotmail.com"
|
22 |
+
}
|
23 |
+
)
|
24 |
+
|
25 |
+
class load_data:
|
26 |
+
'''
|
27 |
+
read some data
|
28 |
+
'''
|
29 |
+
def __init__(self, df, lunar_today, pltdf):
|
30 |
+
self.df = pd.DataFrame()
|
31 |
+
self.lunar_today = ''
|
32 |
+
self.pltdf = pd.DataFrame()
|
33 |
+
self.chinese_char_map = {}
|
34 |
+
|
35 |
+
|
36 |
+
df = pd.read_csv('./dataup/base.csv')
|
37 |
+
lunar_today = re.sub('\D', '', str(lunar_date.from_datetime(datetime.now())))
|
38 |
+
pltdf = pd.DataFrame(data = {
|
39 |
+
'main': '八卦',
|
40 |
+
'wuxing':['金', '金', '火', '火', '木', '木', '土', '土','土', '土', '水', '水'],
|
41 |
+
'bagua': ['乾','兑','离','离','震','巽','坤','坤','艮','艮','坎','坎'],
|
42 |
+
'tiangan':['庚', '辛','丙', '丁', '甲', '乙', '戊', '己', '戊', '己', '壬', '癸'],
|
43 |
+
'dizhi':['申', '酉','巳', '午','寅','卯','辰','戌', '丑', '未', '亥', '子'],
|
44 |
+
'value1': np.repeat(10, 12).tolist()
|
45 |
+
})
|
46 |
+
def plt1():
|
47 |
+
fig = px.sunburst(load_data.pltdf, path=['main', 'wuxing', 'bagua', 'tiangan', 'dizhi'], values='value1',\
|
48 |
+
color_discrete_sequence = px.colors.qualitative.Pastel2[0:8]
|
49 |
+
)
|
50 |
+
return fig
|
51 |
+
|
52 |
+
def count_strokes(words: Iterable) -> int:
|
53 |
+
"""
|
54 |
+
统计字符串中所有文字的笔画总数
|
55 |
+
|
56 |
+
:param words: 需要统计的字符串
|
57 |
+
:return: 笔画总数
|
58 |
+
"""
|
59 |
+
chinese_char_map = {}
|
60 |
+
with open('./dataup/chinese_unicode_table.txt', 'r', encoding='UTF-8') as f:
|
61 |
+
lines = f.readlines()
|
62 |
+
for line in lines[6:]: # 前6行是表头,去掉
|
63 |
+
line_info = line.strip().split()
|
64 |
+
# 处理后的数组第一个是文字,第7个是笔画数量
|
65 |
+
chinese_char_map[line_info[0]] = line_info[6]
|
66 |
+
strokes = 0
|
67 |
+
for word in words:
|
68 |
+
if 0 <= ord(word) <= 126: # 数字,英文符号范围
|
69 |
+
strokes += 1
|
70 |
+
elif 0x4E00 <= ord(word) <= 0x9FA5: # 常用汉字Unicode编码范围4E00-9FA5,20902个字
|
71 |
+
strokes += int(chinese_char_map.get(word, 1))
|
72 |
+
else: # 特殊符号字符一律排在最后
|
73 |
+
strokes += 1
|
74 |
+
return strokes
|
75 |
+
|
76 |
+
|
77 |
+
st.title('正德佷准')
|
78 |
+
st.markdown('--- \n > **人工智能和量子物理结合下的优化版梅花易数**\n ---')
|
79 |
+
# ----
|
80 |
+
import streamlit as st
|
81 |
+
from PIL import Image
|
82 |
+
|
83 |
+
image = Image.open('./dataup/Untitled.jpg')
|
84 |
+
st.image(image, caption='zelinzeling')
|
85 |
+
|
86 |
+
|
87 |
+
selected_target = st.selectbox('测什么?', options = ['选择', '情路', '仕途'])
|
88 |
+
if selected_target == '选择':
|
89 |
+
print('')
|
90 |
+
st.plotly_chart(load_data.plt1())
|
91 |
+
# -----
|
92 |
+
else:
|
93 |
+
'今日是农历: %s \
|
94 |
+
公历 %s'%(load_data.lunar_today, datetime.today().strftime('%Y%m%d'))
|
95 |
+
dizhi = '酉、戌、亥、子、丑、寅、卯、辰、巳、午、未、申'.split('、')
|
96 |
+
|
97 |
+
dict = dict(zip(range(1,13), "子、丑、寅、卯、辰、巳、午、未、申、酉、戌、亥".split('、')))
|
98 |
+
# st.code()
|
99 |
+
name = st.text_input('请输入您的姓名')
|
100 |
+
# st.text()
|
101 |
+
components.html("<html><body>笔画数:%s</body></html>"%load_data.count_strokes(name),
|
102 |
+
width=200, height=30)
|
103 |
+
|
104 |
+
bdate = st.text_input('请输入您的生日', value = '20220304')
|
105 |
+
dizhi = dizhi[int(bdate[0:4])%12 - 1]
|
106 |
+
components.html("<html><body>地支: %s</body></html>"%dizhi,
|
107 |
+
width=200, height=30)
|
108 |
+
|
109 |
+
bt = st.button('测')
|
110 |
+
if (bt == True) & (name != '') & (int(bdate) < 20220101) & (len(name) < 26):
|
111 |
+
st.markdown('恭喜您和刘亦菲谈恋爱')
|
112 |
+
else:
|
113 |
+
st.text("输入信息有误")
|
114 |
+
pass
|
115 |
+
|
116 |
+
|
117 |
+
# st.color_picker()
|
118 |
+
|
119 |
+
# s2.background_gradient(axis=None, vmin=0, vmax=1000, cmap="YlGnBu")
|