siddhartharyaai commited on
Commit
4d532a2
·
verified ·
1 Parent(s): f1bb452

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +7 -4
utils.py CHANGED
@@ -431,16 +431,19 @@ def transcribe_youtube_video(video_url: str) -> str:
431
  def generate_audio_mp3(text: str, speaker: str) -> str:
432
  """
433
  Calls Deepgram TTS with the text, returning a path to a temp MP3 file.
434
- We also do some pre-processing for punctuation, abbreviations, numeric expansions,
435
- plus emotive expressions (ha, sigh, etc.).
436
  """
437
  try:
438
  print(f"[LOG] Generating audio for speaker: {speaker}")
439
- processed_text = _preprocess_text_for_tts(text, speaker)
 
 
 
 
440
 
441
  deepgram_api_url = "https://api.deepgram.com/v1/speak"
442
  params = {
443
- "model": "aura-asteria-en", # female by default
444
  }
445
  if speaker == "John":
446
  params["model"] = "aura-zeus-en"
 
431
  def generate_audio_mp3(text: str, speaker: str) -> str:
432
  """
433
  Calls Deepgram TTS with the text, returning a path to a temp MP3 file.
434
+ Skips preprocessing for John and Jane to preserve natural pronunciation.
 
435
  """
436
  try:
437
  print(f"[LOG] Generating audio for speaker: {speaker}")
438
+ # Skip preprocessing for John and Jane for natural pronunciation.
439
+ if speaker in ["John", "Jane"]:
440
+ processed_text = text
441
+ else:
442
+ processed_text = _preprocess_text_for_tts(text, speaker)
443
 
444
  deepgram_api_url = "https://api.deepgram.com/v1/speak"
445
  params = {
446
+ "model": "aura-asteria-en", # default female voice model
447
  }
448
  if speaker == "John":
449
  params["model"] = "aura-zeus-en"