Posting Decoded Utterances to a Callback Server in Real Time
Description:
Transcribe a short audio file and post the decoded utterances to a callback HTTP server as soon as they are decoded. This example shows how real-time streaming transcription results are provided. The jsontop
output mode is used to make example results shorter and easier to read.
Command:
curl -F utterance_callback=http://10.173.215.203:5555/utterance \ -F datahdr=WAVE -F output=jsontop -F scrubtext=true \ -F file=@sample7.wav \ http://vblaze_name:17171/transcribe
Prerequisites:
To follow this example, you must have a callback server running on a given host and port. If you do not already have a callback server, the easiest way to simulate this is to use the netcat application to listen on a specified port and display the information that it receives. The netcat application is a computer networking utility for reading from and writing to network connections using the TCP or UDP protocols. The name of its executable version is typically nc or nc.exe, depending on the operating system that you are using. The netcat utility is included in most Linux distributions and is freely available for most modern operating systems.
The sample output shown later in this section was produced by a callback server that uses the netcat
command, and which was started using the following Linux command-line command:
$ nc -l 5555 -k
The jsontop
transcript of the audio file produced by the cURL command that was shown previously is the following:
{ "source":"sample7.wav", "confidence":0.89, "donedate":"2019-01-15 15:35:15.292821", "recvtz":["EST",-18000], "text":"Thank you for calling center point energy technical support. I understand you need to report a gas leak and I have your name please my name is Joe and I thank you Mr. Know what is your address or account number my address and then one Martin Houston, Texas is there. Anyone inside the house? I know everyone is out of the house. I notice the strange smell when I got home and I called you I am sending and gas technician to your home to fix the problem. Could you give me a good number to reach you at you can call ######## zero's. Thank you, please be safe and wait for the technician to arrive call us back if anything changes. Thank you, bye. Good bye and thank you for calling center point energy.", "model":"eng1:callcenter", "recvdate":"2019-01-15 15:35:12.888907", "scrubbed":true }
Note
This sample transcript has been manually reformatted to improve readability.
Result:
The following results were produced by using netcat as the utterance_callback
server. The -l
option tells netcat to listen on the network port that is specified as the following argument. The -k
option tells netcat to continue listening for another connection after a current connection is completed.
Note that each block of speech (utterance) is sent to the callback server independently. As with the previous example, identifying information has been replaced with hash marks ('#
'), one per redacted character.
$ nc -l 5555 -k POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 410 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.94,"end":7.76,"recvtz":["EST",-18000],"text":"Thank you for calling center point energy technical support. I understand you need to report a gas leak and I have your name please","start":0.05,"donedate":"2019-01-15 16:00:03.055625","recvdate":"2019-01-15 16:00:00.686514","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":0,"channel":0}}}POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 357 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.83,"end":16.1,"recvtz":["EST",-18000],"text":"my name is Joe and I thank you Mr. Know what is your address or account number","start":9.78,"donedate":"2019-01-15 16:00:03.056699","recvdate":"2019-01-15 16:00:00.692817","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":1,"channel":0}}}POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 571 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.88,"end":41.37,"recvtz":["EST",-18000],"text":"my address and then one Martin Houston, Texas is there. Anyone inside the house? I know everyone is out of the house. I notice the strange smell when I got home and I called you I am sending and gas technician to your home to fix the problem. Could you give me a good number to reach you at","start":18.08,"donedate":"2019-01-15 16:00:03.081001","recvdate":"2019-01-15 16:00:00.886012","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":2,"channel":0}}}POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 325 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.81,"end":49.75,"recvtz":["EST",-18000],"text":"you can call ######## zero's.","start":43.7,"donedate":"2019-01-15 16:00:03.081933","recvdate":"2019-01-15 16:00:00.958482","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":3,"scrubbed":true,"channel":0}}}POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 377 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.94,"end":57.8,"recvtz":["EST",-18000],"text":"Thank you, please be safe and wait for the technician to arrive call us back if anything changes.","start":51.44,"donedate":"2019-01-15 16:00:03.083021","recvdate":"2019-01-15 16:00:00.966422","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":4,"channel":0}}}POST / HTTP/1.1 Host: localhost:5555 Accept-Encoding: identity Content-Length: 352 Content-Type: application/json {"source":"sample7.wav","utterance":{"confidence":0.96,"end":64.71,"recvtz":["EST",-18000],"text":"Thank you, bye. Good bye and thank you for calling center point energy.","start":60.41,"donedate":"2019-01-15 16:00:03.088625","recvdate":"2019-01-15 16:00:00.974230","metadata":{"source":"sample7.wav","model":"eng1:callcenter","uttid":5,"channel":0}}}