salomonsky commited on
Commit
cdce861
·
verified ·
1 Parent(s): fc1568e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import streamlit as st
2
  import base64
3
  import io
@@ -6,6 +7,10 @@ from gtts import gTTS
6
  from audiorecorder import audiorecorder
7
  import speech_recognition as sr
8
 
 
 
 
 
9
  def recognize_speech(audio_data):
10
  st.info("Reconociendo audio...")
11
 
@@ -91,19 +96,20 @@ def main():
91
 
92
  audio_text = recognize_speech("audio.wav")
93
 
94
- output, audio_file = generate(audio_text, history=st.session_state.history)
95
- st.text_area("Respuesta", height=100, value=output, key="output_text", disabled=True)
96
-
97
- if audio_text:
98
- st.session_state.history.append((audio_text, output))
99
-
100
- if audio_file is not None:
101
- st.markdown(
102
- f"""
103
- <audio autoplay="autoplay" controls="controls" src="data:audio/mp3;base64,{base64.b64encode(audio_file.read()).decode()}" type="audio/mp3" id="audio_player"></audio>
104
- """,
105
- unsafe_allow_html=True
106
- )
 
107
 
108
  if __name__ == "__main__":
109
  main()
 
1
+
2
  import streamlit as st
3
  import base64
4
  import io
 
7
  from audiorecorder import audiorecorder
8
  import speech_recognition as sr
9
 
10
+ client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
11
+ pre_prompt = "Te Llamaras Chaman 4.0"
12
+ pre_prompt_sent = False
13
+
14
  def recognize_speech(audio_data):
15
  st.info("Reconociendo audio...")
16
 
 
96
 
97
  audio_text = recognize_speech("audio.wav")
98
 
99
+ if audio_text:
100
+ output, audio_file = generate(audio_text, history=st.session_state.history)
101
+ st.text_area("Respuesta", height=100, value=output, key="output_text", disabled=True)
102
+
103
+ if audio_file is not None:
104
+ st.markdown(
105
+ f"""
106
+ <audio autoplay="autoplay" controls="controls" src="data:audio/mp3;base64,{base64.b64encode(audio_file.read()).decode()}" type="audio/mp3" id="audio_player"></audio>
107
+ """,
108
+ unsafe_allow_html=True
109
+ )
110
+
111
+ if audio_text:
112
+ st.session_state.history.append((audio_text, output))
113
 
114
  if __name__ == "__main__":
115
  main()