Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,7 @@ def take_user_input():
|
|
34 |
query = 'None'
|
35 |
|
36 |
return query
|
|
|
37 |
def format_prompt(message, history):
|
38 |
global pre_prompt_sent
|
39 |
prompt = "<s>"
|
@@ -85,21 +86,20 @@ def text_to_speech(text):
|
|
85 |
return audio_stream.read()
|
86 |
|
87 |
def speak(text):
|
88 |
-
|
89 |
-
audio_file = open(audio_file_path, 'rb')
|
90 |
-
audio_bytes = audio_file.read()
|
91 |
st.audio(audio_bytes, format="audio/mp3", start_time=0, key="audio_player")
|
92 |
|
93 |
if "history" not in st.session_state:
|
94 |
st.session_state.history = []
|
95 |
|
96 |
-
user_input = take_user_input()
|
97 |
-
output, audio_bytes = generate(user_input, history=st.session_state.history)
|
98 |
-
|
99 |
if user_input != 'None':
|
100 |
st.session_state.history.append((user_input, output))
|
101 |
|
102 |
-
st.
|
|
|
|
|
|
|
|
|
103 |
|
104 |
if audio_bytes is not None:
|
105 |
st.markdown(
|
|
|
34 |
query = 'None'
|
35 |
|
36 |
return query
|
37 |
+
|
38 |
def format_prompt(message, history):
|
39 |
global pre_prompt_sent
|
40 |
prompt = "<s>"
|
|
|
86 |
return audio_stream.read()
|
87 |
|
88 |
def speak(text):
|
89 |
+
audio_bytes = text_to_speech(text)
|
|
|
|
|
90 |
st.audio(audio_bytes, format="audio/mp3", start_time=0, key="audio_player")
|
91 |
|
92 |
if "history" not in st.session_state:
|
93 |
st.session_state.history = []
|
94 |
|
|
|
|
|
|
|
95 |
if user_input != 'None':
|
96 |
st.session_state.history.append((user_input, output))
|
97 |
|
98 |
+
with st.container(weight=900, height=400):
|
99 |
+
user_input_container = st.text_input("Tu entrada de usuario", value=user_input)
|
100 |
+
st.text_area("Respuesta", value=output, key="output_text", disabled=True)
|
101 |
+
user_input = take_user_input()
|
102 |
+
output, audio_bytes = generate(user_input, history=st.session_state.history)
|
103 |
|
104 |
if audio_bytes is not None:
|
105 |
st.markdown(
|