Spaces:
Runtime error
Runtime error
add some debug code that suggest that we are still been buffered somehow
Browse files
debug.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from clip_transform import CLIPTransform
|
| 2 |
from chat_service import ChatService
|
| 3 |
from dotenv import load_dotenv
|
|
@@ -6,6 +7,54 @@ from concurrent.futures import ThreadPoolExecutor
|
|
| 6 |
from audio_stream_processor import AudioStreamProcessor
|
| 7 |
from streaming_chat_service import StreamingChatService
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def run_debug_code():
|
| 10 |
load_dotenv()
|
| 11 |
|
|
@@ -43,4 +92,5 @@ def run_debug_code():
|
|
| 43 |
|
| 44 |
|
| 45 |
if __name__ == '__main__':
|
|
|
|
| 46 |
run_debug_code()
|
|
|
|
| 1 |
+
import time
|
| 2 |
from clip_transform import CLIPTransform
|
| 3 |
from chat_service import ChatService
|
| 4 |
from dotenv import load_dotenv
|
|
|
|
| 7 |
from audio_stream_processor import AudioStreamProcessor
|
| 8 |
from streaming_chat_service import StreamingChatService
|
| 9 |
|
| 10 |
+
|
| 11 |
+
def test_sentance_lenghts():
|
| 12 |
+
load_dotenv()
|
| 13 |
+
|
| 14 |
+
print ("Initializing Chat")
|
| 15 |
+
audio_processor = AudioStreamProcessor()
|
| 16 |
+
user_speech_service0 = SpeechService(voice_id="Adam")
|
| 17 |
+
user_speech_service1 = SpeechService(voice_id="Adam")
|
| 18 |
+
user_speech_service2 = SpeechService(voice_id="Adam")
|
| 19 |
+
user_speech_service3 = SpeechService(voice_id="Adam")
|
| 20 |
+
|
| 21 |
+
prompts = [
|
| 22 |
+
"hello, i am a long sentance, how are you today? Tell me about your shadow self?",
|
| 23 |
+
"a shorter sentance",
|
| 24 |
+
"Jung believed that the process of self-discovery and personal growth involves confronting and integrating the shadow self into the conscious mind.",
|
| 25 |
+
"By doing so, we become more self-aware and more fully actualized individuals.",
|
| 26 |
+
]
|
| 27 |
+
first = True
|
| 28 |
+
stream1 = user_speech_service1.stream(prompts[1])
|
| 29 |
+
stream0 = user_speech_service0.stream(prompts[0])
|
| 30 |
+
time.sleep(5)
|
| 31 |
+
stream2 = user_speech_service2.stream(prompts[2])
|
| 32 |
+
stream3 = user_speech_service3.stream(prompts[3])
|
| 33 |
+
audio_processor.add_audio_stream(stream0)
|
| 34 |
+
audio_processor.add_audio_stream(stream1)
|
| 35 |
+
audio_processor.add_audio_stream(stream2)
|
| 36 |
+
audio_processor.add_audio_stream(stream3)
|
| 37 |
+
audio_processor.close()
|
| 38 |
+
from elevenlabs import generate, play
|
| 39 |
+
speech0 = generate(prompts[0], voice="Adam")
|
| 40 |
+
speech1 = generate(prompts[1], voice="Adam")
|
| 41 |
+
speech2 = generate(prompts[2], voice="Adam")
|
| 42 |
+
speech3 = generate(prompts[3], voice="Adam")
|
| 43 |
+
play(speech0)
|
| 44 |
+
play(speech1)
|
| 45 |
+
play(speech2)
|
| 46 |
+
play(speech1)
|
| 47 |
+
play(speech3)
|
| 48 |
+
play(speech1)
|
| 49 |
+
# for prompt in prompts:
|
| 50 |
+
# stream = user_speech_service.stream(prompt)
|
| 51 |
+
# if first:
|
| 52 |
+
# first = False
|
| 53 |
+
# time.sleep(5)
|
| 54 |
+
# audio_processor.add_audio_stream(stream)
|
| 55 |
+
audio_processor.close()
|
| 56 |
+
print ("Chat success")
|
| 57 |
+
|
| 58 |
def run_debug_code():
|
| 59 |
load_dotenv()
|
| 60 |
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
if __name__ == '__main__':
|
| 95 |
+
# test_sentance_lenghts()
|
| 96 |
run_debug_code()
|