jeevzz commited on
Commit
2e0ddd7
·
verified ·
1 Parent(s): ec33e64

Update voice.py

Browse files
Files changed (1) hide show
  1. voice.py +2 -3
voice.py CHANGED
@@ -28,7 +28,7 @@ async def generate_audio(text: str, voice: str) -> str:
28
  print(f"Edge TTS Failed: {e}. Attempting fallback to HF Inference API...")
29
  try:
30
  # Fallback 1: Hugging Face Inference API (Realistic Female Voice)
31
- # using espnet/kan-bayashi_ljspeech_vits (High quality single speaker)
32
  from huggingface_hub import InferenceClient
33
  from dotenv import load_dotenv
34
  from pathlib import Path
@@ -41,8 +41,7 @@ async def generate_audio(text: str, voice: str) -> str:
41
  client = InferenceClient(token=hf_token)
42
 
43
  # Generate audio using HF API
44
- # This model is a high quality female voice
45
- audio_bytes = client.text_to_speech(text, model="espnet/kan-bayashi_ljspeech_vits")
46
 
47
  fd, path = tempfile.mkstemp(suffix=".flac") # Model returns flac usually
48
  os.close(fd)
 
28
  print(f"Edge TTS Failed: {e}. Attempting fallback to HF Inference API...")
29
  try:
30
  # Fallback 1: Hugging Face Inference API (Realistic Female Voice)
31
+ # using facebook/mms-tts-eng (Very reliable)
32
  from huggingface_hub import InferenceClient
33
  from dotenv import load_dotenv
34
  from pathlib import Path
 
41
  client = InferenceClient(token=hf_token)
42
 
43
  # Generate audio using HF API
44
+ audio_bytes = client.text_to_speech(text, model="facebook/mms-tts-eng")
 
45
 
46
  fd, path = tempfile.mkstemp(suffix=".flac") # Model returns flac usually
47
  os.close(fd)