Merge pull request #1782 from MycroftAI/feature/local-precise-model

Allow local model file in precise
pull/1785/head
Åke 2018-09-05 16:56:47 +02:00 committed by GitHub
commit 3c93fea807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -126,9 +126,14 @@ class PreciseHotword(HotWordEngine):
self.show_download_progress = Timer(0, lambda: None)
precise_config = Configuration.get()['precise']
precise_exe = self.install_exe(precise_config['dist_url'])
self.precise_model = self.install_model(
precise_config['model_url'], key_phrase.replace(' ', '-')
).replace('.tar.gz', '.pb')
local_model = self.config.get('local_model_file')
if local_model:
self.precise_model = expanduser(local_model)
else:
self.precise_model = self.install_model(
precise_config['model_url'], key_phrase.replace(' ', '-')
).replace('.tar.gz', '.pb')
self.has_found = False
self.stream = ReadWriteStream()
@ -280,6 +285,7 @@ class HotWordFactory(object):
if not config:
config = Configuration.get()['hotwords']
config = config[hotword]
module = config.get("module", "pocketsphinx")
return cls.load_module(module, hotword, config, lang, loop) or \
cls.load_module('pocketsphinx', hotword, config, lang, loop) or \

View File

@ -166,6 +166,8 @@
"phonemes": "HH EY . M AY K R AO F T",
"threshold": 1e-90,
"lang": "en-us"
// Specify custom model via:
// "local_model_file": "~/.mycroft/precise/models/something.pb"
},
"wake up": {