alphacep / alphacep/vosk-server

Error in connection handler

Offen
#253 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.3k
Forks
317
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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}")
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.