Skip to content

Commit

Permalink
Make speech_recognition import safe so templates don't carry STT depe…
Browse files Browse the repository at this point in the history
…ndencies (#23)

Closes #22
  • Loading branch information
NeonDaniel authored Jan 25, 2022
1 parent 1157418 commit 63a8b95
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ovos_plugin_manager/templates/stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@
"""
import json
from abc import ABCMeta, abstractmethod
from speech_recognition import Recognizer
from queue import Queue
from threading import Thread, Event
from ovos_utils.configuration import read_mycroft_config

try:
from speech_recognition import Recognizer
except ImportError:
Recognizer = None


class STT(metaclass=ABCMeta):
""" STT Base class, all STT backends derives from this one. """

def __init__(self, config=None):
if not Recognizer:
raise ImportError("speech_recognition could not be imported. "
"This can be installed via: "
"`pip install SpeechRecognition")
config_core = {}
if not config:
try:
Expand Down

0 comments on commit 63a8b95

Please sign in to comment.