[WIP/TEST] faster-whisperが最低限動く形で実装
config.jsonで設定変更で実行可能
This commit is contained in:
14
model.py
14
model.py
@@ -65,14 +65,14 @@ class Model:
|
||||
self.speaker_energy_plot_progressbar = None
|
||||
self.translator = Translator()
|
||||
if config.USE_TRANSLATION_FEATURE is True:
|
||||
self.translator.changeCTranslate2Model(config.PATH_LOCAL, config.WEIGHT_TYPE)
|
||||
self.translator.changeCTranslate2Model(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE)
|
||||
self.keyword_processor = KeywordProcessor()
|
||||
|
||||
def checkCTranslatorCTranslate2ModelWeight(self):
|
||||
return checkCTranslate2Weight(config.PATH_LOCAL, config.WEIGHT_TYPE)
|
||||
return checkCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE)
|
||||
|
||||
def changeTranslatorCTranslate2Model(self):
|
||||
self.translator.changeCTranslate2Model(config.PATH_LOCAL, config.WEIGHT_TYPE)
|
||||
self.translator.changeCTranslate2Model(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE)
|
||||
|
||||
def resetKeywordProcessor(self):
|
||||
del self.keyword_processor
|
||||
@@ -335,9 +335,12 @@ class Model:
|
||||
source=self.mic_audio_recorder.source,
|
||||
phrase_timeout=phase_timeout,
|
||||
max_phrases=config.INPUT_MIC_MAX_PHRASES,
|
||||
whisper_enabled=config.USE_RECOGNIZER_FEATURE,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||
whisper_weight_path=os_path.join(config.PATH_LOCAL, "weight", "whisper"),
|
||||
)
|
||||
def sendMicTranscript():
|
||||
mic_transcriber.transcribeAudioQueue(mic_audio_queue, config.SOURCE_LANGUAGE, config.SOURCE_COUNTRY)
|
||||
mic_transcriber.transcribeAudioQueue(config.SELECTED_RECOGNIZER, mic_audio_queue, config.SOURCE_LANGUAGE, config.SOURCE_COUNTRY)
|
||||
message = mic_transcriber.getTranscript()
|
||||
try:
|
||||
fnc(message)
|
||||
@@ -416,6 +419,9 @@ class Model:
|
||||
source=self.speaker_audio_recorder.source,
|
||||
phrase_timeout=phase_timeout,
|
||||
max_phrases=config.INPUT_SPEAKER_MAX_PHRASES,
|
||||
whisper_enabled=config.USE_RECOGNIZER_FEATURE,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||
whisper_weight_path=os_path.join(config.PATH_LOCAL, "weight", "whisper"),
|
||||
)
|
||||
def sendSpeakerTranscript():
|
||||
speaker_transcriber.transcribeAudioQueue(speaker_audio_queue, config.TARGET_LANGUAGE, config.TARGET_COUNTRY)
|
||||
|
||||
Reference in New Issue
Block a user