alumae / kaldi-gstreamer-server

Real-time full-duplex speech recognition server, based on the Kaldi toolkit and the GStreamer framwork.
BSD 2-Clause "Simplified" License
1.07k stars 341 forks source link

py3 branch: client crash due to invalid JSON #232

Open rekado opened 4 years ago

rekado commented 4 years ago

I'm using the py3 branch with the tedlium_nnet_ms_sp_online model. I'm running this on the Bill Gates TED talk mp3. Is recognizes the first few characters but then crashes:

Received message ...
{"status": 0, "segment": 1, "result": {"hypotheses": [{"transcript": "that"s why."}], "final": false}, "id": "ad00b3f2-8787-4d13-9b53-efdd0547c941"}

ERROR:tornado.application:Uncaught exception Expecting ',' delimiter: line 1 column 76 (char 75)

The problem is that the JSON is invalid. There's a double quote instead of a single quote in that"s why.

rekado commented 4 years ago

I don't see anything wrong in the worker log output. The transcript looks fine there.

rekado commented 4 years ago

I guess the problem is in master_server.py in send_event:

self.write_message(json.dumps(event).replace('False', 'false').replace('\'', '\"'))

I wonder why this was deemed necessary.

rekado commented 4 years ago

Removing that final replacement fixes things for me.