Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def text_to_speech(text, speed=1.3):
|
|
35 |
|
36 |
return audio_file_path
|
37 |
|
38 |
-
def generate(user_input, history, temperature=None, max_new_tokens=
|
39 |
global pre_prompt_sent
|
40 |
temperature = float(temperature) if temperature is not None else 0.9
|
41 |
if temperature < 1e-2:
|
@@ -69,14 +69,13 @@ def generate(user_input, history, temperature=None, max_new_tokens=1024, top_p=0
|
|
69 |
if "history" not in st.session_state:
|
70 |
st.session_state.history = []
|
71 |
|
72 |
-
|
73 |
-
|
74 |
|
75 |
if user_input:
|
|
|
76 |
st.session_state.history.append((user_input, output))
|
77 |
|
78 |
-
st.text_area("Salida del Chatbot", value=output, height=400, key="output_text", disabled=True)
|
79 |
-
|
80 |
st.markdown(
|
81 |
f"""
|
82 |
<audio autoplay="autoplay" controls="controls" src="data:audio/mp3;base64,{base64.b64encode(audio_bytes).decode()}" type="audio/mp3" id="audio_player"></audio>
|
|
|
35 |
|
36 |
return audio_file_path
|
37 |
|
38 |
+
def generate(user_input, history, temperature=None, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0):
|
39 |
global pre_prompt_sent
|
40 |
temperature = float(temperature) if temperature is not None else 0.9
|
41 |
if temperature < 1e-2:
|
|
|
69 |
if "history" not in st.session_state:
|
70 |
st.session_state.history = []
|
71 |
|
72 |
+
st.text_area("Salida del Chatbot", value=output, height=400, key="output_text", disabled=True)
|
73 |
+
user_input = st.text_input(label="Ingresa tu mensaje", value="")
|
74 |
|
75 |
if user_input:
|
76 |
+
output, audio_bytes = generate(user_input, history=st.session_state.history)
|
77 |
st.session_state.history.append((user_input, output))
|
78 |
|
|
|
|
|
79 |
st.markdown(
|
80 |
f"""
|
81 |
<audio autoplay="autoplay" controls="controls" src="data:audio/mp3;base64,{base64.b64encode(audio_bytes).decode()}" type="audio/mp3" id="audio_player"></audio>
|