Junr-syl commited on
Commit
4f1d5c6
1 Parent(s): a108eba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -15,7 +15,7 @@ def make_text(audio):
15
  extract_text=text['text']
16
  return extract_text
17
 
18
- st.title('speech recognition')
19
  col1,col2=st.columns(2)
20
  with col1:
21
  with st.form(key='record audio'):
@@ -27,6 +27,7 @@ with col1:
27
  button=st.form_submit_button(label='Convert to Text')
28
  #if the submit button is pressed
29
  if button:
 
30
  try:
31
  #check if audio file
32
  if wave_audio_data is not None:
@@ -50,14 +51,17 @@ with col2:
50
  button=st.form_submit_button(label='Convert to Text')
51
  #if the submit button is pressed
52
  if button:
53
- if upload is not None:
54
- with NamedTemporaryFile() as temp:
55
- temp.write(upload.getvalue())
56
- temp.seek(0)
57
- text = make_text(temp.name)
58
-
59
- st.write(text)
60
-
 
 
 
61
  else:
62
  st.success('No Audio data yet')
63
 
 
15
  extract_text=text['text']
16
  return extract_text
17
 
18
+ st.title('speech recognition, is it worth it!')
19
  col1,col2=st.columns(2)
20
  with col1:
21
  with st.form(key='record audio'):
 
27
  button=st.form_submit_button(label='Convert to Text')
28
  #if the submit button is pressed
29
  if button:
30
+ st.success('audio submitted, processing is slow give us some few seconds')
31
  try:
32
  #check if audio file
33
  if wave_audio_data is not None:
 
51
  button=st.form_submit_button(label='Convert to Text')
52
  #if the submit button is pressed
53
  if button:
54
+ st.success('audio submitted, processing is slow give us some few seconds')
55
+ try:
56
+ if upload is not None:
57
+ with NamedTemporaryFile() as temp:
58
+ temp.write(upload.getvalue())
59
+ temp.seek(0)
60
+ text = make_text(temp.name)
61
+
62
+ st.write(text)
63
+ except:
64
+ st.write("we can't process your request at the moment")
65
  else:
66
  st.success('No Audio data yet')
67