yuanjie commited on
Commit
f652093
1 Parent(s): de6b4b1
pages/0__Info.py → 0__Info.py RENAMED
File without changes
AppZoo.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def run():
5
+ st.set_page_config(
6
+ page_title="Hello",
7
+ page_icon="👋",
8
+ )
9
+
10
+ st.write("# Welcome to AppZoo! 👋")
11
+
12
+ st.markdown(
13
+ """
14
+ > 应用集合
15
+ """
16
+ )
17
+
18
+
19
+ if __name__ == "__main__":
20
+ run()
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: green
5
  colorTo: gray
6
  sdk: streamlit
7
  sdk_version: 1.10.0
8
- app_file: app.py
9
  pinned: true
10
  license: mit
11
  ---
 
5
  colorTo: gray
6
  sdk: streamlit
7
  sdk_version: 1.10.0
8
+ app_file: AppZoo.py
9
  pinned: true
10
  license: mit
11
  ---
app.py DELETED
@@ -1,51 +0,0 @@
1
- # Copyright 2018-2022 Streamlit Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import streamlit as st
16
- from streamlit.logger import get_logger
17
-
18
- LOGGER = get_logger(__name__)
19
-
20
-
21
- def run():
22
- st.set_page_config(
23
- page_title="Hello",
24
- page_icon="👋",
25
- )
26
-
27
- st.write("# Welcome to Streamlit! 👋")
28
-
29
- st.sidebar.success("Select a demo above.")
30
-
31
- st.markdown(
32
- """
33
- Streamlit is an open-source app framework built specifically for
34
- Machine Learning and Data Science projects.
35
- **👈 Select a demo from the sidebar** to see some examples
36
- of what Streamlit can do!
37
- ### Want to learn more?
38
- - Check out [streamlit.io](https://streamlit.io)
39
- - Jump into our [documentation](https://docs.streamlit.io)
40
- - Ask a question in our [community
41
- forums](https://discuss.streamlit.io)
42
- ### See more complex demos
43
- - Use a neural net to [analyze the Udacity Self-driving Car Image
44
- Dataset](https://github.com/streamlit/demo-self-driving)
45
- - Explore a [New York City rideshare dataset](https://github.com/streamlit/demo-uber-nyc-pickups)
46
- """
47
- )
48
-
49
-
50
- if __name__ == "__main__":
51
- run()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/lr.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a25d13f7011117e75f4cdb5f50181519adb93f248f759aa6c79bb7354c340d9
3
+ size 771
git_init.sh CHANGED
@@ -1,5 +1,7 @@
1
  #!/usr/bin/env bash
2
 
 
 
3
  git add *
4
  git commit -m "update"
5
 
 
1
  #!/usr/bin/env bash
2
 
3
+ #git config --global credential.helper store
4
+
5
  git add *
6
  git commit -m "update"
7
 
pages/1_🔥_模型生成代码.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 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.text(code)
43
+
44
+
45
+
46
+ if __name__ == '__main__':
47
+ app_title = "ModelToCode"
48
+ app_info = """
49
+ 将训练过的统计模型转化为本地代码(`Python, C, Java, Go, JavaScript, Visual Basic, c#, PowerShell, R, PHP, Dart, Haskell, Ruby, f#, Rust, Elixir`)。
50
+ """
51
+ MyPage(
52
+ app_title=f"# {app_title}",
53
+ app_info=f"> {app_info}",
54
+ sidebar_title=None,
55
+ ).main()
pages/1_🔥_食品安全比赛提交.py DELETED
@@ -1,24 +0,0 @@
1
- import paramiko
2
- from meutils.pipe import *
3
- import streamlit as st
4
-
5
- host = 'sftp.ai.xm.gov.cn' # 主机
6
- port = 57891 # 端口
7
- sf = paramiko.Transport((host, port))
8
-
9
- username = st.text_input('username', 'comp_5154') # 用户名
10
- password = st.text_input('password') # 密码
11
-
12
-
13
- uploaded_file = st.file_uploader("上传文件")
14
- if uploaded_file is not None and password:
15
- df = pd.read_csv(uploaded_file, '|', header=0)
16
- df.to_csv('result.txt', '|',index=False)
17
-
18
- sf.connect(username=username, password=password)
19
- sftp = paramiko.SFTPClient.from_transport(sf)
20
-
21
- _ = sftp.put('result.txt', '/result/result.txt')
22
- st.write(_)
23
-
24
- st.write(df)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  meutils
2
- paramiko
 
 
1
  meutils
2
+
3
+ m2cgen
result.txt CHANGED
The diff for this file is too large to render. See raw diff
 
run.sh CHANGED
@@ -6,7 +6,5 @@
6
  # @Software : PyCharm
7
  # @Description : ${DESCRIPTION}
8
 
9
- #streamlit run mapps.py
10
- #streamlit-launchpad ./examples
11
- streamlit run app.py
12
 
 
6
  # @Software : PyCharm
7
  # @Description : ${DESCRIPTION}
8
 
9
+ streamlit run AppZoo.py
 
 
10