jeevzz commited on
Commit
ce1be07
·
verified ·
1 Parent(s): ac62da3

Update voice.py

Browse files
Files changed (1) hide show
  1. voice.py +6 -0
voice.py CHANGED
@@ -41,7 +41,13 @@ async def generate_audio(text: str, voice: str) -> str:
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)
 
41
  client = InferenceClient(token=hf_token)
42
 
43
  # Generate audio using HF API
44
+ # Using facebook/mms-tts-eng which is very reliable
45
+ print(f"Attempting HF Inference with model: facebook/mms-tts-eng")
46
+ if not hf_token:
47
+ print("WARNING: HF_TOKEN is missing! HF Inference API might fail or be rate limited.")
48
+
49
  audio_bytes = client.text_to_speech(text, model="facebook/mms-tts-eng")
50
+ print(f"HF Inference successful, received {len(audio_bytes)} bytes")
51
 
52
  fd, path = tempfile.mkstemp(suffix=".flac") # Model returns flac usually
53
  os.close(fd)