(NOTE: You don't need to know much about the Kaldi ASR project for this thread. It's just a speech recognition engine that allows you to build your own language models.)
On my voice recognition project, I found an example of how to use Kaldi in a browser and it is written in python. I really like it, but I'm a .NET guy and the project I want to incorporate this in is ASP.NET Core.
I can mostly read Python syntax, but am utterly unfamiliar with the Python web server used in this project. Here is what I understand and what I don't: (Please correct any mistakes)
Can anyone help fill in the blanks for me? I think I can handle re-writing it in asp.NET if I get understand what Python is doing here.
On my voice recognition project, I found an example of how to use Kaldi in a browser and it is written in python. I really like it, but I'm a .NET guy and the project I want to incorporate this in is ASP.NET Core.
I can mostly read Python syntax, but am utterly unfamiliar with the Python web server used in this project. Here is what I understand and what I don't: (Please correct any mistakes)
- The web server is started by running server.py with arguments of "--servers /server/servers.json".
- The server begins listening on port 8080, but I don't know why. (Servers.json specifies port 5050, but netstat never shows anything listening on port 5050, and the code never mentions 8080) Is 5050 used somewhere?
- Demo begins by calling HTTP://localhost:8080 which serves up Index.html and client.js
- The user clicks the Start button which starts an RTC connection via POST localhost:8080/offer and connects the microphone audio to the RTC connection.
- On the server the Offer method connects the RTC connection and initializes the kaldi object with KaldiSink() from kaldi.py
- The KaldiSink.start(self) method is called. I don't understand what the self object is. Is it just a reference to an instance of the class or something else?
- Once the two-way connection is created, somehow the server audio input gets fed into the Kaldi engine, and the text output of the Kaldi gets fed back to the client. How does the webserver get an instance of the Kaldi engine? Where is it coming from file-wise? How is this instance wired up to the RTC connection?
Can anyone help fill in the blanks for me? I think I can handle re-writing it in asp.NET if I get understand what Python is doing here.