File size: 899 Bytes
3369999
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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()