Skip to content

Commit e7acefd

Browse files
committed
Update README
1 parent 22dcd22 commit e7acefd

File tree

1 file changed

+56
-5
lines changed

1 file changed

+56
-5
lines changed

README.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ Attention
1313

1414
The ASR server that will be set up here requires some [kaldi models](http://www.kaldi.org). In the docker image I will detail below, there are no kaldi models included.
1515

16-
You must have these models on your machine. You must also an yaml file describing these models. Please, check some examples [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/sample_worker.yaml), [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/estonian_worker.yaml) and [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/sample_english_nnet2.yaml) to find out how to write your own yaml files.
16+
You must have these models on your machine. You must also have an yaml file describing these models. Please, check some examples [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/sample_worker.yaml), [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/estonian_worker.yaml) and [here](https://github.com/alumae/kaldi-gstreamer-server/blob/master/sample_english_nnet2.yaml) to find out how to write your own yaml files.
1717

1818
There are some kaldi models available for download. I have tested my setup with this [one](https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz), which is for English. I'm trying to build a model for Brazilian Portuguese, but until now I didn't find enough free/open resources.
1919

20+
2021
Install docker
2122
--------------
2223

@@ -44,10 +45,10 @@ It's possible to use the same docker in two scenarios. You may create the master
4445

4546
* Instantiate master server and worker server on the same machine:
4647

47-
Assuming that your kaldi models are located at /home/models on your host machine, create a container:
48+
Assuming that your kaldi models are located at /media/kaldi_models on your host machine, create a container:
4849

4950
```
50-
docker run -it -p 8080:80 -v /home/models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
51+
docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
5152
```
5253

5354
And, inside the container, start the service:
@@ -65,10 +66,10 @@ For stopping the servers, you may execute the following command inside your cont
6566

6667
* Instantiate a worker server and connect it to a remote master:
6768

68-
Assuming that your kaldi models are located at /home/models on your host machine, create a container:
69+
Assuming that your kaldi models are located at /media/kaldi_models on your host machine, create a container:
6970

7071
```
71-
docker run -it -v /home/models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
72+
docker run -it -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
7273
```
7374

7475
And, inside the container, start the service:
@@ -119,6 +120,56 @@ After checking the setup, you should test your speech recognition service. For t
119120

120121
3. A Javascript client is available at http://kaljurand.github.io/dictate.js/. You must configure it to use your ASR service.
121122

123+
124+
Practical Example
125+
-----------------
126+
127+
This section describes a tested example. You may repeat all the steps and, in the end, you'll have an english ASR system working on your machine.
128+
129+
On the host machine, we are going to work on the directory /media/kaldi_models. I'll assume you have all permissions necessary to execute the following commands.
130+
131+
1. Pull docker image:
132+
```
133+
docker pull jcsilva/docker-kaldi-gstreamer-server
134+
```
135+
136+
2. Download a valid kaldi model:
137+
```
138+
cd /media/kaldi_models
139+
wget https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz
140+
tar -zxvf tedlium_nnet_ms_sp_online.tgz
141+
```
142+
143+
3. Copy an example yaml file to /media/kaldi_models:
144+
```
145+
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/sample_english_nnet2.yaml -P /media/kaldi_models
146+
147+
```
148+
149+
4. Update file paths:
150+
```
151+
find /media/kaldi_models/ -type f | xargs sed -i 's:test:/opt:g'
152+
```
153+
154+
5. Instantiate master and worker on the same machine:
155+
```
156+
docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
157+
```
158+
159+
6. Inside the docker container, start the service:
160+
```
161+
/opt/start.sh -y /opt/models/sample_english_nnet2.yaml
162+
```
163+
164+
7. On your host machine, download a client example and test your setup with a given audio:
165+
```
166+
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/kaldigstserver/client.py -P /tmp
167+
wget https://github.com/alumae/kaldi-gstreamer-server/blob/master/test/data/bill_gates-TED.mp3 -P /tmp
168+
python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 32000 /tmp/bill_gates-TED.mp3
169+
```
170+
171+
OBS: For running the client example, you must install ws4py version 0.3.2. This can be installed using `pip install --user ws4py==0.3.2`. You may also need simplejson and pyaudio. They may also be installed using pip.
172+
122173
Credits
123174
--------
124175
* [kaldi](http://www.kaldi.org)

0 commit comments

Comments
 (0)