Commit 336171e 1 parent fd15758 commit 336171e Copy full SHA for 336171e
File tree 1 file changed +7
-2
lines changed
vocode/streaming/synthesizer
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import io
2
2
import wave
3
3
4
- from cartesia .tts import AsyncCartesiaTTS
5
-
6
4
from vocode import getenv
7
5
from vocode .streaming .models .message import BaseMessage
8
6
from vocode .streaming .models .synthesizer import CartesiaSynthesizerConfig
9
7
from vocode .streaming .synthesizer .base_synthesizer import BaseSynthesizer , SynthesisResult
10
8
11
9
12
10
class CartesiaSynthesizer (BaseSynthesizer [CartesiaSynthesizerConfig ]):
11
+ cartesia_tts = None
12
+
13
13
def __init__ (
14
14
self ,
15
15
synthesizer_config : CartesiaSynthesizerConfig ,
16
16
):
17
17
super ().__init__ (synthesizer_config )
18
18
19
+ # Lazy import the cartesia module
20
+ if CartesiaSynthesizer .cartesia_tts is None :
21
+ from cartesia .tts import AsyncCartesiaTTS
22
+ CartesiaSynthesizer .cartesia_tts = AsyncCartesiaTTS
23
+
19
24
self .api_key = getenv ("CARTESIA_API_KEY" )
20
25
self .model_id = synthesizer_config .model_id
21
26
self .voice_id = synthesizer_config .voice_id
You can’t perform that action at this time.
0 commit comments