[bug] board

This commit is contained in:
IrvingGao committed 2024-05-23 20:00:40 +08:00
1 parent 6a9edd9139
commit 2a298fb5e2
3 files changed
+113 -46

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
from takway.clients.client_utils import BaseWebSocketClient
from takway.audio_utils import AudioPlayer
if __name__ == '__main__':
server_url = 'ws://takway-ai.top:8001/chat/streaming/temporary'
session_id = '469f4a99-12a5-45a6-bc91-353df07423b6' # 新
client = BaseWebSocketClient(server_url, session_id)
client.wakeup_client()
wave_file = 'example_recording.wav'
player = AudioPlayer()
frames = player.load_audio_file(wave_file)
client.send_per_data(audio=frames, voice_synthesize=True, is_end=True, encoding='base64')
while True:
try:
response, data_type = client.receive_per_data()
print(response[0], len(response[1]))
except:
pass