|
@@ -1,65 +0,0 @@
|
|
|
-"""NEO entrypoint"""
|
|
|
-from datetime import datetime
|
|
|
-
|
|
|
-import streamlit as st
|
|
|
-
|
|
|
-from db import subject
|
|
|
-from components.remove_style import hide_footer
|
|
|
-
|
|
|
-
|
|
|
-def _set_main_page_config():
|
|
|
- # set_page_config must be the first command,
|
|
|
- # and must only be set once per page.
|
|
|
- st.set_page_config(
|
|
|
- page_title="NEO",
|
|
|
- page_icon=":house:",
|
|
|
- )
|
|
|
- hide_footer()
|
|
|
-
|
|
|
-
|
|
|
-def _create_subject(conn):
|
|
|
- with st.form("subject_form"):
|
|
|
- st.write("创建用户")
|
|
|
- name = st.text_input("姓名")
|
|
|
- gender = st.radio("性别", ["男", "女"])
|
|
|
- birthday = st.date_input("生日")
|
|
|
- submitted = st.form_submit_button("确定")
|
|
|
- if submitted:
|
|
|
- create_time = datetime.strptime(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "%Y-%m-%d %H:%M:%S")
|
|
|
- sub_new = {"name": name, "gender": gender, "birthday": birthday, "create_time": create_time}
|
|
|
- subject.create_subject(conn, sub_new)
|
|
|
-
|
|
|
-
|
|
|
-def _main_page_content():
|
|
|
- st.write("# NEO! 👋")
|
|
|
-
|
|
|
-
|
|
|
- conn = st.connection("sql_app", type="sql")
|
|
|
- subject.create_table(conn)
|
|
|
- _create_subject(conn)
|
|
|
- subjects = subject.get_subjects(conn)
|
|
|
- st.write("# 用户列表")
|
|
|
-
|
|
|
- st.dataframe(subjects)
|
|
|
-
|
|
|
- st.markdown(
|
|
|
- """
|
|
|
- ### 更多信息
|
|
|
- - 点击查看 [Neuracle](http://www.neuracle.cn)
|
|
|
- """
|
|
|
- )
|
|
|
-
|
|
|
- st.markdown(
|
|
|
- """
|
|
|
- 版权所有 © 博睿康科技(常州)股份有限公司
|
|
|
- """
|
|
|
- )
|
|
|
-
|
|
|
-
|
|
|
-def start_app():
|
|
|
- _set_main_page_config()
|
|
|
- _main_page_content()
|
|
|
- return True
|
|
|
-
|
|
|
-
|
|
|
-start_app()
|