lilingxi01 commited on
Commit
4ae1cd4
β€’
1 Parent(s): 039b1e4

[UI] Make interface better and add name-checking.

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -16,10 +16,12 @@ if not has_prepared:
16
  prepare()
17
  has_prepared = True
18
 
19
- st.title('Entity Referring Classifier')
20
- st.caption('It knows exactly when you are calling it. - Version 2.0.1208.01')
21
-
22
- st.markdown('---')
 
 
23
 
24
  livedemo_col1, livedemo_col2, livedemo_col3 = st.columns([12,1,6])
25
 
@@ -31,7 +33,10 @@ with livedemo_col1:
31
  sentence = st.text_input('Sentence Input:', 'Are you feeling good, Jimmy?',
32
  help='The classifier is going to analyze this sentence.')
33
  if st.form_submit_button('πŸš€ Submit'):
34
- st.session_state['running_status'] = STATUS_SUBMIT
 
 
 
35
 
36
  if st.session_state['running_status'] == STATUS_STOPPED:
37
  st.info('Type something and submit to start!')
@@ -41,6 +46,8 @@ with livedemo_col1:
41
  else:
42
  st.success('It is a **mentioning**!')
43
  st.caption(f'Submitted: `{sentence.lower()}` by `{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}`')
 
 
44
 
45
  with livedemo_col2:
46
  st.empty()
@@ -51,7 +58,7 @@ with livedemo_col3:
51
  """)
52
  st.markdown("""
53
  Hi! I'm the Entity Referring Classifier.
54
- I can help you find out when you are calling it.
55
  """)
56
  st.markdown("""
57
  #### Terms
 
16
  prepare()
17
  has_prepared = True
18
 
19
+ st.markdown("""
20
+ <center><h2 style="padding-top: 0px; padding-bottom: 0px;">Entity Referring Classifier</h2></center>
21
+ <center><small>Ver 2.0.1208.01</small></center>
22
+ <center><h6><b>It knows exactly when you are calling it.</b></h6></center>
23
+ <br/>
24
+ """, unsafe_allow_html=True)
25
 
26
  livedemo_col1, livedemo_col2, livedemo_col3 = st.columns([12,1,6])
27
 
 
33
  sentence = st.text_input('Sentence Input:', 'Are you feeling good, Jimmy?',
34
  help='The classifier is going to analyze this sentence.')
35
  if st.form_submit_button('πŸš€ Submit'):
36
+ if entity.lower() not in sentence.lower():
37
+ st.session_state['running_status'] = STATUS_ERROR
38
+ else:
39
+ st.session_state['running_status'] = STATUS_SUBMIT
40
 
41
  if st.session_state['running_status'] == STATUS_STOPPED:
42
  st.info('Type something and submit to start!')
 
46
  else:
47
  st.success('It is a **mentioning**!')
48
  st.caption(f'Submitted: `{sentence.lower()}` by `{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}`')
49
+ elif st.session_state['running_status'] == STATUS_ERROR:
50
+ st.warning('The entity name is not in the sentence!')
51
 
52
  with livedemo_col2:
53
  st.empty()
 
58
  """)
59
  st.markdown("""
60
  Hi! I'm the Entity Referring Classifier.
61
+ I will fill this part later.
62
  """)
63
  st.markdown("""
64
  #### Terms