gorkemgoknar commited on
Commit
a84846e
1 Parent(s): 41ac656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -200,6 +200,7 @@ def generate_local(
200
  temperature=temperature,
201
  max_tokens=max_tokens,
202
  top_p=top_p,
 
203
  )
204
 
205
  formatted_prompt = format_prompt(prompt, history,system_message=system_message)
@@ -594,14 +595,16 @@ def generate_speech_for_sentence(history, chatbot_role, sentence, return_as_byte
594
  sentence = sentence.replace(")", " ")
595
  sentence = sentence.replace("<|assistant|>","")
596
 
 
 
 
 
597
  # A fast fix for last chacter, may produce weird sounds if it is with text
598
  if (sentence[-1] in ["!", "?", ".", ","]) or (sentence[-2] in ["!", "?", ".", ","]):
599
  # just add a space
600
  sentence = sentence[:-1] + " " + sentence[-1]
601
  print("Sentence for speech:", sentence)
602
- if len(sentence)==0:
603
- print("EMPTY SENTENCE after processing")
604
- return
605
 
606
  try:
607
  SENTENCE_SPLIT_LENGTH=350
 
200
  temperature=temperature,
201
  max_tokens=max_tokens,
202
  top_p=top_p,
203
+ stop=stop,
204
  )
205
 
206
  formatted_prompt = format_prompt(prompt, history,system_message=system_message)
 
595
  sentence = sentence.replace(")", " ")
596
  sentence = sentence.replace("<|assistant|>","")
597
 
598
+ if len(sentence)==0:
599
+ print("EMPTY SENTENCE after processing")
600
+ return
601
+
602
  # A fast fix for last chacter, may produce weird sounds if it is with text
603
  if (sentence[-1] in ["!", "?", ".", ","]) or (sentence[-2] in ["!", "?", ".", ","]):
604
  # just add a space
605
  sentence = sentence[:-1] + " " + sentence[-1]
606
  print("Sentence for speech:", sentence)
607
+
 
 
608
 
609
  try:
610
  SENTENCE_SPLIT_LENGTH=350