YingxuHe commited on
Commit
c050149
·
verified ·
1 Parent(s): 7840695

Update pages.py

Browse files
Files changed (1) hide show
  1. pages.py +11 -43
pages.py CHANGED
@@ -8,33 +8,6 @@ from streamlit_mic_recorder import mic_recorder
8
 
9
  from utils import load_model, generate_response, bytes_to_array, start_server
10
 
11
- def home_page():
12
- ## Set up home page Title
13
- col1, col2 = st.columns([1, 4])
14
- custom_html = """
15
- <div class="banner">
16
- <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRhB2e_AhOe11wKxnnwOmOVg9E7J1MBgiTeYzzFAESwcCP5IbBAc2X8BwGChMfJzwqtVg&usqp=CAU" alt="Banner Image">
17
- </div>
18
- <style>
19
- .banner {
20
- width: 100%;
21
- height: 200px;
22
- overflow: visible;
23
- }
24
- .banner img {
25
- width: 100%;
26
- object-fit: cover;
27
- }
28
- </style>
29
- """
30
- with col1:
31
- components.html(custom_html)
32
- with col2:
33
- st.write("# Welcome to MERaLiON-AudioLLM ChatBot 🤖")
34
-
35
- ## Set up home page other information
36
- st.markdown('')
37
-
38
 
39
  def audio_llm():
40
  with st.sidebar:
@@ -47,7 +20,13 @@ def audio_llm():
47
  <p>Spoken Dialogue Summarization</p>
48
  <p>Speech Instruction</p>
49
  <p>Paralinguistics</p>
 
 
50
  </div>""", unsafe_allow_html=True)
 
 
 
 
51
 
52
 
53
  if st.sidebar.button('Clear History'):
@@ -77,20 +56,10 @@ def audio_llm():
77
  It is tailored for Singapore’s multilingual and multicultural landscape."""
78
  )
79
 
80
- st.markdown("##### Step1: Specify Model Configuration")
81
- col4, col5 = st.columns(2)
82
-
83
- with col4:
84
- st.slider(label='Temperature', min_value=0.0, max_value=2.0, value=0.7, key='temperature')
85
-
86
- with col5:
87
- st.slider(label='Top P', min_value=0.0, max_value=1.0, value=1.0, key='top_p')
88
-
89
- st.markdown("##### Step2: Specify Audio")
90
  col1, col2, col3 = st.columns(3)
91
 
92
  with col2:
93
- st.markdown("Record Audio:")
94
 
95
  recording = mic_recorder(
96
  format="wav",
@@ -104,7 +73,7 @@ def audio_llm():
104
  st.session_state.audio_array = bytes_to_array(audio_bytes)
105
 
106
  with col3:
107
- st.markdown("Upload Audio:")
108
 
109
  uploaded_file = st.file_uploader(
110
  label="**Upload Audio:**",
@@ -181,7 +150,7 @@ def audio_llm():
181
 
182
  audio_sample_names = [audio_sample_name for audio_sample_name in audio_samples_w_instruct.keys()]
183
 
184
- st.markdown("Select From Examples:")
185
 
186
  sample_name = st.selectbox(
187
  label="**Select Audio:**",
@@ -201,9 +170,8 @@ def audio_llm():
201
  st.audio(st.session_state.audio_array, format="audio/wav", sample_rate=16000)
202
  st.session_state.update(on_upload=False, on_record=False, on_select=False)
203
 
204
- st.markdown("##### Step 3: Input your Instruction")
205
  if st.session_state.default_instruction:
206
- st.write("Example Instructions:")
207
  st.write(st.session_state.default_instruction)
208
 
209
  st.markdown(
@@ -230,7 +198,7 @@ def audio_llm():
230
  st.write(message["content"])
231
 
232
  if prompt := st.chat_input(
233
- placeholder="Your Instruction",
234
  disabled=st.session_state.disprompt,
235
  on_submit=lambda: st.session_state.update(disprompt=True)
236
  ):
 
8
 
9
  from utils import load_model, generate_response, bytes_to_array, start_server
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  def audio_llm():
13
  with st.sidebar:
 
20
  <p>Spoken Dialogue Summarization</p>
21
  <p>Speech Instruction</p>
22
  <p>Paralinguistics</p>
23
+ <br>
24
+ <p><strong>📎 Configuration</strong>
25
  </div>""", unsafe_allow_html=True)
26
+
27
+ st.slider(label='Temperature', min_value=0.0, max_value=2.0, value=0.7, key='temperature')
28
+
29
+ st.slider(label='Top P', min_value=0.0, max_value=1.0, value=1.0, key='top_p')
30
 
31
 
32
  if st.sidebar.button('Clear History'):
 
56
  It is tailored for Singapore’s multilingual and multicultural landscape."""
57
  )
58
 
 
 
 
 
 
 
 
 
 
 
59
  col1, col2, col3 = st.columns(3)
60
 
61
  with col2:
62
+ st.markdown("**Record Audio:**")
63
 
64
  recording = mic_recorder(
65
  format="wav",
 
73
  st.session_state.audio_array = bytes_to_array(audio_bytes)
74
 
75
  with col3:
76
+ st.markdown("**Upload Audio:**")
77
 
78
  uploaded_file = st.file_uploader(
79
  label="**Upload Audio:**",
 
150
 
151
  audio_sample_names = [audio_sample_name for audio_sample_name in audio_samples_w_instruct.keys()]
152
 
153
+ st.markdown("**Select Audio From Examples:**")
154
 
155
  sample_name = st.selectbox(
156
  label="**Select Audio:**",
 
170
  st.audio(st.session_state.audio_array, format="audio/wav", sample_rate=16000)
171
  st.session_state.update(on_upload=False, on_record=False, on_select=False)
172
 
 
173
  if st.session_state.default_instruction:
174
+ st.write("**Example Instructions:**")
175
  st.write(st.session_state.default_instruction)
176
 
177
  st.markdown(
 
198
  st.write(message["content"])
199
 
200
  if prompt := st.chat_input(
201
+ placeholder="Type Your Instruction Here",
202
  disabled=st.session_state.disprompt,
203
  on_submit=lambda: st.session_state.update(disprompt=True)
204
  ):