serve.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:earmark 作者: lowerquality 项目源码 文件源码
def re_run(self, utt):
        if 'wavpath' not in utt:
            return

        k = Kaldi(
            get_resource('data/nnet_a_gpu_online'),
            self.gen_hclg_filename,
            get_resource('PROTO_LANGDIR'))
        audio = numm3.sound2np(
            os.path.join(self.resources['attach'].attachdir, utt['wavpath']),
            nchannels=1,
            R=8000)
        k.push_chunk(audio.tostring())
        wds = k.get_final()
        k.stop()
        for wd in wds:
            del wd['phones']
        utt['command_words'] = wds
        utt['command'] = ' '.join([X['word'] for X in wds])

        reactor.callFromThread(self.db.onchange, None, {"type": "change",
                                                        "id": utt["_id"],
                                                        "doc": utt})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号