CineAI commited on
Commit
42bce02
1 Parent(s): b5e3b33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -2,25 +2,24 @@
2
 
3
  import psutil
4
 
5
- import numpy as np
6
-
7
  import streamlit as st
8
  from audio2text.a2t import A2T
9
- from st_audiorec import st_audiorec
 
 
10
 
11
  def main():
12
- audio = st_audiorec()
13
-
14
- if audio is not None:
15
  print(type(audio))
16
  if st.button("Get text"):
17
  with st.spinner("Wait for it...."):
18
- a2t = A2T(audio)
19
  text = a2t.predict()
20
  print("Text output in main : ", text)
21
  st.write(text)
22
  st.success("Done")
23
  del audio
 
24
  else:
25
  print("error audio is None")
26
 
 
2
 
3
  import psutil
4
 
 
 
5
  import streamlit as st
6
  from audio2text.a2t import A2T
7
+ from audiorecorder import audiorecorder
8
+
9
+ audio = audiorecorder("Record", "Stop")
10
 
11
  def main():
12
+ if len(audio) > 0:
13
+ a2t = A2T(audio)
 
14
  print(type(audio))
15
  if st.button("Get text"):
16
  with st.spinner("Wait for it...."):
 
17
  text = a2t.predict()
18
  print("Text output in main : ", text)
19
  st.write(text)
20
  st.success("Done")
21
  del audio
22
+ del a2t
23
  else:
24
  print("error audio is None")
25