yuanjie commited on
Commit
ee83c82
1 Parent(s): 7f570be
AppZoo.py CHANGED
@@ -16,5 +16,6 @@ def run():
16
  )
17
 
18
 
 
19
  if __name__ == "__main__":
20
  run()
 
16
  )
17
 
18
 
19
+
20
  if __name__ == "__main__":
21
  run()
git_init.sh CHANGED
@@ -3,7 +3,7 @@
3
  #git config --global credential.helper store
4
 
5
  git add *
6
- git commit -m "update"
7
 
8
  git pull
9
- git push
 
3
  #git config --global credential.helper store
4
 
5
  git add *
6
+ git commit -m "update" # git commit --amend -m '重新commit'
7
 
8
  git pull
9
+ git push -f
pages/1_🔥_模型生成代码.py CHANGED
@@ -8,38 +8,39 @@ import streamlit as st
8
  class MyPage(Page):
9
 
10
  def main(self):
11
- file = st.file_uploader('上传默模型文件')
12
- if file:
13
- estimator = joblib.load(file)
14
- else:
15
- estimator = joblib.load(get_resolve_path('../data/lr.pkl', __file__))
16
-
17
- languages = [
18
- 'python',
19
- 'java',
20
- 'go',
21
- 'c',
22
- 'c_sharp',
23
- 'r',
24
- 'dart',
25
- 'elixir',
26
- 'f_sharp',
27
- 'haskell',
28
- 'javascript',
29
- 'php',
30
- 'powershell',
31
- 'ruby',
32
- 'rust',
33
- 'visual_basi'
34
- ]
35
-
36
- _ = st.selectbox('选择输出语言', languages)
37
-
38
- if st.button('开始转换'):
39
- code = m2c.__getattribute__(f'export_to_{_}')(estimator)
40
-
41
- st.markdown("##### code:")
42
- st.code(code)
 
43
 
44
 
45
 
 
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
 
pages/2_📚_PDF预览.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from meutils.pipe import *
2
+ from appzoo.streamlit_app import Page
3
+
4
+ import streamlit as st
5
+
6
+ """
7
+ https://zhuanlan.zhihu.com/p/518115802?utm_medium=social&utm_oi=1290068536690085888
8
+ """
9
+ class MyPage(Page):
10
+
11
+ def main(self):
12
+ with st.form("PDF"):
13
+ file = st.file_uploader("选择待上传的PDF文件", type=['pdf'])
14
+
15
+ if st.form_submit_button('开始预览', help='先上传文件!!!'):
16
+ if file is not None:
17
+ base64_pdf = base64.b64encode(file.read()).decode('utf-8')
18
+ pdf_display = f"""<embed src="data:application/pdf;base64,{base64_pdf}" width="100%" height="800" type="application/pdf">"""
19
+ st.markdown(pdf_display, unsafe_allow_html=True)
20
+
21
+
22
+ if __name__ == '__main__':
23
+ app_title = "# PDF应用"
24
+ app_info = "PDF预览"
25
+ MyPage(
26
+ app_title=app_title,
27
+ app_info=app_info,
28
+ sidebar_title=None,
29
+ ).main()
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
  meutils
2
 
3
- m2cgen
4
- appzoo
 
1
  meutils
2
 
3
+ m2cgen
 
test.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : Python.
4
+ # @File : test
5
+ # @Time : 2022/9/30 下午3:27
6
+ # @Author : yuanjie
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+
12
+ from meutils.pipe import *
13
+
14
+ #
15
+ # def file_replace(file, old, new):
16
+ # p = Path(file)
17
+ # _ = (
18
+ # p.read_text().replace(old, new)
19
+ # )
20
+ # p.write_text(_)
21
+ #
22
+ #
23
+ # import streamlit as st
24
+ #
25
+ # st_home = Path(str(st).split("'")[-2]).parent
26
+ #
27
+ # to_replace = [
28
+ # (st_home/ "static/static/js/main.468e22f6.chunk.js", "https://github.com/streamlit/streamlit/issues/new/choose", "https://github.com/yuanjie-ai"),
29
+ # (st_home/ "static/static/js/main.468e22f6.chunk.js", "Streamlit Inc. All rights reserved.", "Betterme Inc. All rights reserved."),
30
+ # ]
31
+ # for i in to_replace:
32
+ # file_replace(*i)
33
+ #
34
+
35
+ print(open(get_resolve_path('./data/【东北计算机】恒生电子2021业绩说明会纪要.pdf', __file__), "rb").read())