raynardj commited on
Commit
34a5c7b
1 Parent(s): 735386f

🍶 base line

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -30,6 +30,7 @@ import streamlit as st
30
  st.title("Wenyanwen Translator")
31
  st.markdown("""
32
  # Translate from Chinese to Ancient Chinese / 还你古朴清雅壮丽的文言文, 这[github](https://github.com/raynardj/yuan)
 
33
  """)
34
 
35
  @st.cache
@@ -42,4 +43,9 @@ tokenizer, model = load_model()
42
 
43
  text = st.text_area("轻轻地我走了,正如我轻轻地来。我挥一挥衣袖,不带走一片云彩。")
44
 
45
- st.write(inference(text)[0])
 
 
 
 
 
 
30
  st.title("Wenyanwen Translator")
31
  st.markdown("""
32
  # Translate from Chinese to Ancient Chinese / 还你古朴清雅壮丽的文言文, 这[github](https://github.com/raynardj/yuan)
33
+ 最多100个中文字符, 谢谢!
34
  """)
35
 
36
  @st.cache
 
43
 
44
  text = st.text_area("轻轻地我走了,正如我轻轻地来。我挥一挥衣袖,不带走一片云彩。")
45
 
46
+ if st.button("Translate"):
47
+ if len(text) > 100:
48
+ st.error("超过100个字符")
49
+ else:
50
+ st.write(inference(text)[0])
51
+