CineAI commited on
Commit
8685a84
1 Parent(s): 0056a29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -1,27 +1,21 @@
1
  # version - ArticMonkey:19.03.24:1743
2
 
3
  import psutil
4
- import base64
5
- import time
6
  import sys
7
 
8
  import streamlit as st
 
 
9
  from audio_processing.A2T import A2T
10
  from audio_processing.T2A import T2A
11
  from llm.llm import LLM_chain
 
 
12
  from streamlit_mic_recorder import mic_recorder
 
13
 
14
  llmchain = LLM_chain()
15
 
16
- # def autoplay(audio: bytes, duration: float, wait: bool=True, sr: int = 16_000):
17
- # if audio:
18
- # audio_bytes = audio
19
- # duration = duration
20
- # audio_base64 = base64.b64encode(audio_bytes).decode('utf-8')
21
- # st.audio(audio_base64, sample_rate=sr)
22
- # if wait:
23
- # time.sleep(2)
24
-
25
  def main():
26
  mic = mic_recorder(start_prompt="Record",stop_prompt="Stop", just_once=True)
27
 
@@ -29,10 +23,13 @@ def main():
29
  a2t = A2T(mic["bytes"])
30
  text = a2t.predict()
31
  response = llmchain(entity=text, id=0)
 
 
 
 
32
  print(sys.getsizeof(response))
33
- audio, sr, duration = T2A(response).get_audio()
34
- st.audio(audio, sample_rate=sr)
35
  print(sys.getsizeof(audio))
 
36
  del response
37
  del audio
38
 
 
1
  # version - ArticMonkey:19.03.24:1743
2
 
3
  import psutil
 
 
4
  import sys
5
 
6
  import streamlit as st
7
+
8
+ # my modules
9
  from audio_processing.A2T import A2T
10
  from audio_processing.T2A import T2A
11
  from llm.llm import LLM_chain
12
+
13
+ # libraries from other authors
14
  from streamlit_mic_recorder import mic_recorder
15
+ from streamlit_TTS import auto_play
16
 
17
  llmchain = LLM_chain()
18
 
 
 
 
 
 
 
 
 
 
19
  def main():
20
  mic = mic_recorder(start_prompt="Record",stop_prompt="Stop", just_once=True)
21
 
 
23
  a2t = A2T(mic["bytes"])
24
  text = a2t.predict()
25
  response = llmchain(entity=text, id=0)
26
+
27
+ audio, _, _ = T2A(response).get_audio()
28
+ auto_play(audio)
29
+
30
  print(sys.getsizeof(response))
 
 
31
  print(sys.getsizeof(audio))
32
+
33
  del response
34
  del audio
35