Yurii Paniv commited on
Commit
a5c7abb
1 Parent(s): 8451e68

Add scorer

Browse files
Files changed (4) hide show
  1. .gitignore +2 -1
  2. Dockerfile +1 -1
  3. client.py +1 -6
  4. templates/hello.html +0 -1
.gitignore CHANGED
@@ -131,4 +131,5 @@ dmypy.json
131
  *.tflite
132
  .DS_Store
133
 
134
- /data
 
 
131
  *.tflite
132
  .DS_Store
133
 
134
+ /data
135
+ *.scorer
Dockerfile CHANGED
@@ -4,6 +4,6 @@ WORKDIR /app
4
  RUN apt-get update
5
  RUN apt-get install -y ffmpeg
6
  RUN wget https://github.com/robinhad/voice-recognition-ua/releases/download/v0.4/uk.tflite
7
- RUN wget https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/deepspeech-0.9.3-models.tflite
8
  RUN pip install -r requirements.txt
9
  CMD uwsgi app.ini --http 0.0.0.0:$PORT
 
4
  RUN apt-get update
5
  RUN apt-get install -y ffmpeg
6
  RUN wget https://github.com/robinhad/voice-recognition-ua/releases/download/v0.4/uk.tflite
7
+ RUN wget https://github.com/robinhad/voice-recognition-ua/releases/download/v0.4/kenlm.scorer
8
  RUN pip install -r requirements.txt
9
  CMD uwsgi app.ini --http 0.0.0.0:$PORT
client.py CHANGED
@@ -14,14 +14,9 @@ def client(audio_file, lang="uk"):
14
  model_load_start = timer()
15
  # sphinx-doc: python_ref_model_start
16
  model = "./uk.tflite"
17
- if lang not in ["en", "uk"]:
18
- lang = "uk"
19
- if lang == "uk":
20
- model = "./uk.tflite"
21
- if lang == "en":
22
- model = "./deepspeech-0.9.1-models.tflite"
23
 
24
  ds = Model(model)
 
25
  # sphinx-doc: python_ref_model_stop
26
  model_load_end = timer() - model_load_start
27
  print('Loaded model in {:.3}s.'.format(model_load_end), file=sys.stderr)
 
14
  model_load_start = timer()
15
  # sphinx-doc: python_ref_model_start
16
  model = "./uk.tflite"
 
 
 
 
 
 
17
 
18
  ds = Model(model)
19
+ ds.enableExternalScorer("kenlm.scorer")
20
  # sphinx-doc: python_ref_model_stop
21
  model_load_end = timer() - model_load_start
22
  print('Loaded model in {:.3}s.'.format(model_load_end), file=sys.stderr)
templates/hello.html CHANGED
@@ -22,7 +22,6 @@
22
  <div class="col-5 col-sm-3">
23
  <select id="lang" class="browser-default custom-select" style="width: 100%">
24
  <option selected value="uk">Українська</option>
25
- <option value="en">Англійська</option>
26
  </select>
27
  </div>
28
  </div>
 
22
  <div class="col-5 col-sm-3">
23
  <select id="lang" class="browser-default custom-select" style="width: 100%">
24
  <option selected value="uk">Українська</option>
 
25
  </select>
26
  </div>
27
  </div>