Spaces:
Runtime error
Runtime error
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 | |
def run_debug_code(): | |
load_dotenv() | |
# print ("Initializing CLIP templates") | |
# clip_transform = CLIPTransform() | |
# print ("CLIP success") | |
print ("Initializing Chat") | |
chat_service = ChatService() | |
user_speech_service = SpeechService(voice_id="Adam") | |
ai_speech_service = SpeechService(voice_id="2OviOUQc1JsQRQgNkVBj") # Chales003 | |
processor = AudioStreamProcessor() | |
# 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) | |
processor.add_audio_stream(stream) | |
response = chat_service.chat(prompt) | |
print ("") | |
print (f'response: "{response}"') | |
stream = ai_speech_service.stream(response) | |
processor.add_audio_stream(stream) | |
processor.close() | |
print ("Chat success") | |
if __name__ == '__main__': | |
run_debug_code() |