gorkemgoknar commited on
Commit
245a4de
1 Parent(s): d1584df
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -346,7 +346,7 @@ def get_voice_streaming(prompt, language, latent_tuple, suffix="0"):
346
  gpt_cond_latent,
347
  speaker_embedding,
348
  #repetition_penalty=5.0,
349
- #temperature=0.75,
350
  )
351
 
352
  first_chunk = True
@@ -578,9 +578,13 @@ def generate_speech_for_sentence(history, chatbot_role, sentence, return_as_byte
578
  return
579
 
580
  # A fast fix for last chacter, may produce weird sounds if it is with text
581
- if (sentence[-1] in ["!", "?", ".", ","]) or (sentence[-2] in ["!", "?", ".", ","]):
582
- # just add a space
583
- sentence = sentence[:-1] + " " + sentence[-1]
 
 
 
 
584
  print("Sentence for speech:", sentence)
585
 
586
 
 
346
  gpt_cond_latent,
347
  speaker_embedding,
348
  #repetition_penalty=5.0,
349
+ temperature=0.85,
350
  )
351
 
352
  first_chunk = True
 
578
  return
579
 
580
  # A fast fix for last chacter, may produce weird sounds if it is with text
581
+ #if (sentence[-1] in ["!", "?", ".", ","]) or (sentence[-2] in ["!", "?", ".", ","]):
582
+ # # just add a space
583
+ # sentence = sentence[:-1] + " " + sentence[-1]
584
+
585
+ # regex does the job well
586
+ sentence= re.sub("([^\x00-\x7F]|\w)(\.|\。|\?|\!)",r"\1 \2",sentence)
587
+
588
  print("Sentence for speech:", sentence)
589
 
590