File size: 1,420 Bytes
c58cbbc
35d97c8
 
9202468
4385b66
 
bd435b3
35d97c8
4385b66
 
35d97c8
4385b66
 
 
69f88db
4385b66
bd435b3
 
 
69f88db
4385b66
69f88db
4385b66
69f88db
4385b66
 
 
 
 
 
 
 
 
 
bd435b3
9202468
4385b66
bd435b3
 
c58cbbc
bd435b3
4385b66
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from clip_transform import CLIPTransform
from chat_service import ChatService
from dotenv import load_dotenv
from speech_service import SpeechService
from concurrent.futures import ThreadPoolExecutor
from audio_stream_processor import AudioStreamProcessor
from streaming_chat_service import StreamingChatService

def run_debug_code():
    load_dotenv()

    # print ("Initializing CLIP templates")
    # clip_transform = CLIPTransform()
    # print ("CLIP success")

    print ("Initializing Chat")
    # chat_service = ChatService()
    audio_processor = AudioStreamProcessor()
    chat_service = StreamingChatService(audio_processor, voice_id="2OviOUQc1JsQRQgNkVBj") # Chales003

    user_speech_service = SpeechService(voice_id="Adam")

    # user_speech_service.print_voices() # if you want to see your custom voices

    prompts = [
        "hello, how are you today?",
        "tell me about your shadow self?",
        "hmm, interesting, tell me more about that.",
        "wait, that is so interesting, what else?",
    ]
    for prompt in prompts:
        print ("")
        print (f'prompt: "{prompt}"')
        stream = user_speech_service.stream(prompt)
        audio_processor.add_audio_stream(stream)

        print ("")
        print (f'response:')
        response = chat_service.respond_to(prompt)

    audio_processor.close()
    print ("Chat success")


if __name__ == '__main__':
    run_debug_code()