ciyidogan commited on
Commit
6db89b2
Β·
verified Β·
1 Parent(s): 5cb67b6

Update tts_elevenlabs.py

Browse files
Files changed (1) hide show
  1. tts_elevenlabs.py +6 -5
tts_elevenlabs.py CHANGED
@@ -4,6 +4,7 @@ ElevenLabs TTS Implementation
4
  import httpx
5
  from typing import Optional, Dict
6
  from tts_interface import TTSInterface, log
 
7
 
8
  class ElevenLabsTTS(TTSInterface):
9
  """ElevenLabs TTS implementation"""
@@ -25,7 +26,7 @@ class ElevenLabsTTS(TTSInterface):
25
 
26
  # Debug log
27
  masked_key = f"{api_key[:4]}...{api_key[-4:]}" if len(api_key) > 8 else "***"
28
- log(f"πŸ”‘ ElevenLabsTTS initialized with key: {masked_key}")
29
 
30
  async def synthesize(self, text: str, voice_id: Optional[str] = None, **kwargs) -> bytes:
31
  """Convert text to speech using ElevenLabs API"""
@@ -57,7 +58,7 @@ class ElevenLabsTTS(TTSInterface):
57
  else:
58
  params = {"output_format": "mp3_44100_128"}
59
 
60
- log(f"🎀 Calling ElevenLabs TTS for {len(text)} characters")
61
 
62
  async with httpx.AsyncClient(timeout=30.0) as client:
63
  response = await client.post(
@@ -70,14 +71,14 @@ class ElevenLabsTTS(TTSInterface):
70
  response.raise_for_status()
71
  audio_data = response.content
72
 
73
- log(f"βœ… ElevenLabs TTS returned {len(audio_data)} bytes")
74
  return audio_data
75
 
76
  except httpx.HTTPStatusError as e:
77
- log(f"❌ ElevenLabs API error: {e.response.status_code} - {e.response.text}")
78
  raise
79
  except Exception as e:
80
- log(f"❌ TTS synthesis error: {e}")
81
  raise
82
 
83
  def get_supported_voices(self) -> Dict[str, str]:
 
4
  import httpx
5
  from typing import Optional, Dict
6
  from tts_interface import TTSInterface, log
7
+ from logger import log_info, log_error, log_debug, log_warning
8
 
9
  class ElevenLabsTTS(TTSInterface):
10
  """ElevenLabs TTS implementation"""
 
26
 
27
  # Debug log
28
  masked_key = f"{api_key[:4]}...{api_key[-4:]}" if len(api_key) > 8 else "***"
29
+ log_debug(f"πŸ”‘ ElevenLabsTTS initialized with key: {masked_key}")
30
 
31
  async def synthesize(self, text: str, voice_id: Optional[str] = None, **kwargs) -> bytes:
32
  """Convert text to speech using ElevenLabs API"""
 
58
  else:
59
  params = {"output_format": "mp3_44100_128"}
60
 
61
+ log_degub(f"🎀 Calling ElevenLabs TTS for {len(text)} characters")
62
 
63
  async with httpx.AsyncClient(timeout=30.0) as client:
64
  response = await client.post(
 
71
  response.raise_for_status()
72
  audio_data = response.content
73
 
74
+ log_debug(f"βœ… ElevenLabs TTS returned {len(audio_data)} bytes")
75
  return audio_data
76
 
77
  except httpx.HTTPStatusError as e:
78
+ log_error(f"❌ ElevenLabs API error: {e.response.status_code} - {e.response.text}")
79
  raise
80
  except Exception as e:
81
+ log_error("❌ TTS synthesis error", e)
82
  raise
83
 
84
  def get_supported_voices(self) -> Dict[str, str]: