Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,10 @@ import io
|
|
4 |
from huggingface_hub import InferenceClient
|
5 |
from gtts import gTTS
|
6 |
from streamlit_mic_recorder import mic_recorder
|
7 |
-
import wave
|
8 |
import speech_recognition as sr
|
9 |
from pydub import AudioSegment
|
10 |
|
11 |
-
pre_prompt_text = "eres una IA conductual, tus respuestas serán breves."
|
12 |
|
13 |
if "history" not in st.session_state:
|
14 |
st.session_state.history = []
|
@@ -41,6 +40,10 @@ def recognize_speech(audio_data, show_messages=True):
|
|
41 |
def format_prompt(message, history):
|
42 |
prompt = "<s>"
|
43 |
|
|
|
|
|
|
|
|
|
44 |
for user_prompt, bot_response in history:
|
45 |
prompt += f"[INST] {user_prompt} [/INST]"
|
46 |
prompt += f" {bot_response}</s> "
|
|
|
4 |
from huggingface_hub import InferenceClient
|
5 |
from gtts import gTTS
|
6 |
from streamlit_mic_recorder import mic_recorder
|
|
|
7 |
import speech_recognition as sr
|
8 |
from pydub import AudioSegment
|
9 |
|
10 |
+
pre_prompt_text = "Hablarás español, tus principios el estoícismo, eres una IA conductual, tus respuestas serán breves."
|
11 |
|
12 |
if "history" not in st.session_state:
|
13 |
st.session_state.history = []
|
|
|
40 |
def format_prompt(message, history):
|
41 |
prompt = "<s>"
|
42 |
|
43 |
+
if not st.session_state.pre_prompt_sent:
|
44 |
+
prompt += f"[INST] {pre_prompt_text} [/INST]"
|
45 |
+
st.session_state.pre_prompt_sent = True
|
46 |
+
|
47 |
for user_prompt, bot_response in history:
|
48 |
prompt += f"[INST] {user_prompt} [/INST]"
|
49 |
prompt += f" {bot_response}</s> "
|