ggoknar
commited on
Commit
·
10f2f46
1
Parent(s):
a38b58d
system message update
Browse files
app.py
CHANGED
|
@@ -86,6 +86,15 @@ Current date: CURRENT_DATE .
|
|
| 86 |
|
| 87 |
system_message = os.environ.get("SYSTEM_MESSAGE", default_system_message)
|
| 88 |
system_message = system_message.replace("CURRENT_DATE", str(datetime.date.today()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
temperature = 0.9
|
| 90 |
top_p = 0.6
|
| 91 |
repetition_penalty = 1.2
|
|
@@ -126,9 +135,7 @@ def get_latents(speaker_wav):
|
|
| 126 |
|
| 127 |
def format_prompt(message, history):
|
| 128 |
prompt = (
|
| 129 |
-
"<s>[INST]"
|
| 130 |
-
+ system_message
|
| 131 |
-
+ "[/INST] I understand, I am a Mistral chatbot with speech by Coqui team.</s>"
|
| 132 |
)
|
| 133 |
for user_prompt, bot_response in history:
|
| 134 |
prompt += f"[INST] {user_prompt} [/INST]"
|
|
@@ -473,31 +480,6 @@ def generate_speech(history):
|
|
| 473 |
yield (gr.Audio.update(value=wav_bytestream, autoplay=False), history)
|
| 474 |
|
| 475 |
|
| 476 |
-
css = """
|
| 477 |
-
.bot .chatbot p {
|
| 478 |
-
overflow: hidden; /* Ensures the content is not revealed until the animation */
|
| 479 |
-
//border-right: .15em solid orange; /* The typwriter cursor */
|
| 480 |
-
white-space: nowrap; /* Keeps the content on a single line */
|
| 481 |
-
margin: 0 auto; /* Gives that scrolling effect as the typing happens */
|
| 482 |
-
letter-spacing: .15em; /* Adjust as needed */
|
| 483 |
-
animation:
|
| 484 |
-
typing 3.5s steps(40, end);
|
| 485 |
-
blink-caret .75s step-end infinite;
|
| 486 |
-
}
|
| 487 |
-
|
| 488 |
-
/* The typing effect */
|
| 489 |
-
@keyframes typing {
|
| 490 |
-
from { width: 0 }
|
| 491 |
-
to { width: 100% }
|
| 492 |
-
}
|
| 493 |
-
|
| 494 |
-
/* The typewriter cursor effect */
|
| 495 |
-
@keyframes blink-caret {
|
| 496 |
-
from, to { border-color: transparent }
|
| 497 |
-
50% { border-color: orange; }
|
| 498 |
-
}
|
| 499 |
-
"""
|
| 500 |
-
|
| 501 |
with gr.Blocks(title=title) as demo:
|
| 502 |
gr.Markdown(DESCRIPTION)
|
| 503 |
|
|
|
|
| 86 |
|
| 87 |
system_message = os.environ.get("SYSTEM_MESSAGE", default_system_message)
|
| 88 |
system_message = system_message.replace("CURRENT_DATE", str(datetime.date.today()))
|
| 89 |
+
|
| 90 |
+
default_system_understand_message = (
|
| 91 |
+
"I understand, I am a Mistral chatbot with speech by Coqui team."
|
| 92 |
+
)
|
| 93 |
+
system_understand_message = os.environ.get(
|
| 94 |
+
"SYSTEM_UNDERSTAND_MESSAGE", default_system_understand_message
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
temperature = 0.9
|
| 99 |
top_p = 0.6
|
| 100 |
repetition_penalty = 1.2
|
|
|
|
| 135 |
|
| 136 |
def format_prompt(message, history):
|
| 137 |
prompt = (
|
| 138 |
+
"<s>[INST]" + system_message + "[/INST]" + system_understand_message + "</s>"
|
|
|
|
|
|
|
| 139 |
)
|
| 140 |
for user_prompt, bot_response in history:
|
| 141 |
prompt += f"[INST] {user_prompt} [/INST]"
|
|
|
|
| 480 |
yield (gr.Audio.update(value=wav_bytestream, autoplay=False), history)
|
| 481 |
|
| 482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
with gr.Blocks(title=title) as demo:
|
| 484 |
gr.Markdown(DESCRIPTION)
|
| 485 |
|