alphacep / alphacep/vosk-server

Error in connection handler

Đang mở
#253 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.3k
Fork
317
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I get the following error with this python code:
---------------------------------------------------------
INFO:root:Connection from ('xx.xx.xxx.xxx', 63393)
INFO:root:Config {'sample_rate': 16000}
ERROR:websockets.server:Error in connection handler
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/websockets/server.py", line 191, in handler
await self.ws_handler(self, path)
File "/opt/vosk-server/websocket/./asr_server.py", line 70, in recognize
await websocket.send(response)
File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 555, in send
await self.ensure_open()
File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 803, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1000 (OK), no reason

```py
# Konfiguration für den Vosk-Server
vosk_server_url = 'ws://xx.xx.xxx.xxx:2700'

async def run_vosk_client(uri):
async with websockets.connect(uri) as websocket:
print("WebSocket connection established.")

duration = 5 # Aufnahmedauer in Sekunden
sample_rate = 16000 # Abtastfrequenz in Hz

print(f"Sprechen Sie etwas für {duration} Sekunden...")

audio_data = await record_audio(duration, sample_rate)

config_message = json.dumps({"config": {"sample_rate": sample_rate}})
await websocket.send(config_message)

await websocket.send(audio_data)
await websocket.send('{"eof" : 1}')

response = await websocket.recv()
print(f"Erkannter Text: {response}")
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.