Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chyroc committed Mar 3, 2025
1 parent 5be50c8 commit 967e00e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/benchmark_websockets_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import os
import time
from time import sleep
from typing import List, Optional

from cozepy import (
Expand Down Expand Up @@ -109,6 +108,7 @@ async def generate_audio(coze: AsyncCoze, text: str) -> List[bytes]:
sample_rate=24000,
**kwargs,
)
content.write_to_file("test.wav")
return [data for data in content._raw_response.iter_bytes(chunk_size=1024)]


Expand Down Expand Up @@ -141,8 +141,8 @@ async def test_latency(coze: AsyncCoze, bot_id: str, audios: List[bytes]) -> Asy
}
)
)
# sleep(len(delta)*1.0/24000/2) # ms
sleep(1.5)
await asyncio.sleep(len(delta) * 1.0 / 24000 / 2)

await client.input_audio_buffer_complete()
handler.input_audio_buffer_completed_at = int(time.time() * 1000)
await client.wait(
Expand All @@ -166,6 +166,8 @@ async def main():
# Initialize Audio
audios = await generate_audio(coze, text)

exit(0)

times = 50
text_latency = []
audio_latency = []
Expand Down

0 comments on commit 967e00e

Please sign in to comment.