lilingxi01 commited on
Commit
74abd6a
1 Parent(s): c1f0c0e

[UI] Adjust the dependency structure and contents.

Browse files
Files changed (1) hide show
  1. app.py +64 -53
app.py CHANGED
@@ -1,34 +1,30 @@
1
  import streamlit as st
2
  from datetime import datetime
3
 
4
- from modules.prediction import prepare, predict
5
 
6
  STATUS_STOPPED = 120001
7
  STATUS_SUBMIT = 120002
8
  STATUS_ERROR = 120003
9
 
10
- has_prepared = False
11
-
12
  st.session_state['running_status'] = STATUS_STOPPED
13
 
14
- if not has_prepared:
15
- print('>>> [PREPARE] Preparing...')
16
- prepare()
17
- has_prepared = True
18
-
19
  st.markdown("""
20
- <center><h2 style="padding-top: 0px; padding-bottom: 8px;">Entity Referring Classifier</h2></center>
21
- <center><h6 style="color: #bfbfbf"><b>It knows exactly when you are calling it.</b></h6></center>
22
- <br/>
23
- """, unsafe_allow_html=True)
24
 
25
  livedemo_col1, livedemo_col2, livedemo_col3 = st.columns([12,1,6])
26
 
27
  with livedemo_col1:
 
 
28
  st.markdown("""
29
- <h3>Live Demo <small style="font-size:12px; color: #cfcfcf">version 2.0.1.1208</small></h3>
30
- """, unsafe_allow_html=True)
31
 
 
32
  with st.form("live_demo_form"):
33
  entity = st.text_input('Entity Name:', 'Jimmy')
34
  sentence = st.text_input('Sentence Input:', 'Are you feeling good, Jimmy?',
@@ -51,57 +47,72 @@ with livedemo_col1:
51
  st.warning('The entity name is not in the sentence!')
52
 
53
  st.markdown("""
54
- #### Corpus
55
- """)
56
  st.markdown("""
57
- <small style="font-size: 19px; padding-bottom: 6px;"><b><code>Calling</code></b></small>
58
- means that the sentence contains the name and is telling to the entity.<br/>
59
- <small style="color: #afafaf">
60
- <b><i>Examples:</i></b><br/>
61
- <b>-</b> Are you feeling good about it Jimmy?<br/>
62
- <b>-</b> Are you feeling good Jimmy?<br/>
63
- <b>-</b> Jimmy you are so cool!
64
- </small>
65
- """, unsafe_allow_html=True)
66
  st.markdown("""
67
- <small style="font-size: 19px; padding-bottom: 6px;"><b><code>Mentioning</code></b></small>
68
- means that the sentence contains the name but is telling to other person.<br/>
69
- <small style="color: #afafaf">
70
- <b><i>Examples:</i></b><br/>
71
- <b>-</b> Are you feeling good about Jimmy?<br/>
72
- <b>-</b> Have you heard about Jimmy?<br/>
73
- <b>-</b> Jimmy said that you are so cool!
74
- </small>
75
- """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  with livedemo_col2:
78
  st.empty()
79
 
80
  with livedemo_col3:
81
  st.markdown("""
82
- #### Get Started
83
- """)
84
  st.markdown("""
85
- Hi! I'm the Entity Referring Classifier.
86
- Specify an entity name, and then type a sentence to get started!
87
- """)
88
 
89
  st.markdown("""
90
- #### Background
91
- """)
92
  st.markdown("""
93
- There are a lot of voice assistants and bots out there,
94
- but they all need a specific prefix to wake them like “hey siri” or “hey alexa”.
95
- At our real world, nobody is communicating with others with such prefix all the time.
96
- Everyone should be able to communicate in a comfortable way including with bots and virtual assistants.
97
- Our aim here is to get rid of the "wake phrase".
98
- """)
99
 
100
  st.markdown("""
101
- #### Applications
102
- """)
103
  st.markdown("""
104
- Developers can apply it on their virtual bots or voice assistants to detect
105
- if the user is calling the bot or just mentioning the bot rather than detecting a fixed wake-up phrase.
106
- It will improve the human-computer interaction and usability.
107
- """)
 
 
 
1
  import streamlit as st
2
  from datetime import datetime
3
 
4
+ from ercbcm import predict
5
 
6
  STATUS_STOPPED = 120001
7
  STATUS_SUBMIT = 120002
8
  STATUS_ERROR = 120003
9
 
 
 
10
  st.session_state['running_status'] = STATUS_STOPPED
11
 
 
 
 
 
 
12
  st.markdown("""
13
+ <center><h2 style="padding-top: 0px; padding-bottom: 8px;">Entity Referring Classifier</h2></center>
14
+ <center><h6 style="color: #bfbfbf"><b>It knows exactly when you are calling it.</b></h6></center>
15
+ <br/>
16
+ """, unsafe_allow_html=True)
17
 
18
  livedemo_col1, livedemo_col2, livedemo_col3 = st.columns([12,1,6])
19
 
20
  with livedemo_col1:
21
+
22
+ # Version.
23
  st.markdown("""
24
+ <h3>Live Demo <small style="font-size:12px; color: #cfcfcf">version 2.1.0.1216</small></h3>
25
+ """, unsafe_allow_html=True)
26
 
27
+ # Live Demo form.
28
  with st.form("live_demo_form"):
29
  entity = st.text_input('Entity Name:', 'Jimmy')
30
  sentence = st.text_input('Sentence Input:', 'Are you feeling good, Jimmy?',
 
47
  st.warning('The entity name is not in the sentence!')
48
 
49
  st.markdown("""
50
+ #### Corpus
51
+ """)
52
  st.markdown("""
53
+ <small style="font-size: 19px; padding-bottom: 6px;"><b><code>Calling</code></b></small>
54
+ means that the sentence contains the name and is telling to the entity.<br/>
55
+ <small style="color: #afafaf">
56
+ <b><i>Examples:</i></b><br/>
57
+ <b>-</b> Are you feeling good about it Jimmy?<br/>
58
+ <b>-</b> Are you feeling good Jimmy?<br/>
59
+ <b>-</b> Jimmy you are so cool!
60
+ </small>
61
+ """, unsafe_allow_html=True)
62
  st.markdown("""
63
+ <small style="font-size: 19px; padding-bottom: 6px;"><b><code>Mentioning</code></b></small>
64
+ means that the sentence contains the name but is telling to other person.<br/>
65
+ <small style="color: #afafaf">
66
+ <b><i>Examples:</i></b><br/>
67
+ <b>-</b> Are you feeling good about Jimmy?<br/>
68
+ <b>-</b> Have you heard about Jimmy?<br/>
69
+ <b>-</b> Jimmy said that you are so cool!
70
+ </small>
71
+ """, unsafe_allow_html=True)
72
+
73
+ st.markdown("""
74
+ #### Applications and Future Works
75
+ """)
76
+ st.markdown("""
77
+ Developers can apply it on their virtual bots or voice assistants to detect
78
+ if the user is calling the bot or just mentioning the bot rather than detecting a fixed wake-up phrase.
79
+ It will improve the human-computer interaction and usability.
80
+
81
+ Additionally, Lingxi is going to expand the project into Simplified Chinese in the future,
82
+ implement it into a Discord Bot,
83
+ and deliver it into medium-sized channels to see if users feel better in communicating with bots in this way
84
+ and if it works well in conversations in practice.
85
+ If it works well,
86
+ we may try to combine it with the speech-to-text to analyze the experience in the context of voice,
87
+ which has a lot more complicated scenarios.
88
+ """)
89
 
90
  with livedemo_col2:
91
  st.empty()
92
 
93
  with livedemo_col3:
94
  st.markdown("""
95
+ #### Get Started
96
+ """)
97
  st.markdown("""
98
+ Hi! I'm the Entity Referring Classifier.
99
+ Specify an entity name, and then type a sentence to get started!
100
+ """)
101
 
102
  st.markdown("""
103
+ #### Members
104
+ """)
105
  st.markdown("""
106
+ Lingxi Li, Li Xu, Zachary Polak, Tudor-Cristian Foca
107
+ """)
 
 
 
 
108
 
109
  st.markdown("""
110
+ #### Background
111
+ """)
112
  st.markdown("""
113
+ There are a lot of voice assistants and bots out there,
114
+ but they all need a specific prefix to wake them like “hey siri” or “hey alexa”.
115
+ At our real world, nobody is communicating with others with such prefix all the time.
116
+ Everyone should be able to communicate in a comfortable way including with bots and virtual assistants.
117
+ Our aim here is to get rid of the "wake phrase".
118
+ """)