from meutils.pipe import * from appzoo.streamlit_app import Page import streamlit as st from LAC import LAC # @st.experimental_memo(persist='disk', show_spinner=True, suppress_st_warning=False, max_entries=None, ttl=64) @st.cache(func=None, persist=False, hash_funcs={'LAC.lac.LAC': str}, ttl=8) def tokenizer1(): print('Loading tokenizer1...') return LAC() @st.experimental_singleton def tokenizer2(): print('Loading tokenizer2...') return LAC() class MyPage(Page): def main(self): with st.form("Coding"): text = st.text_input("输入文本", "") if st.form_submit_button('开始转换'): _ = tokenizer1().run(text) _ = tokenizer2().run(text) st.json(_) if __name__ == '__main__': app_title = "# 切词" app_info = "" MyPage(app_title=app_title, app_info=app_info).main()