mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
30 lines
1001 B
Python
30 lines
1001 B
Python
from .sentiment import Sentiment
|
|
from .tts import TTS
|
|
from ..asr.asr import ASR
|
|
from .audio_to_text import AudioToText
|
|
from .blackbox import Blackbox
|
|
from .calculator import Calculator
|
|
from .text_to_audio import TextToAudio
|
|
|
|
|
|
class BlackboxFactory:
|
|
|
|
def __init__(self) -> None:
|
|
self.tts = TTS()
|
|
self.asr = ASR("./.env.yaml")
|
|
self.sentiment = Sentiment()
|
|
|
|
def create_blackbox(self, blackbox_name: str, blackbox_config: dict) -> Blackbox:
|
|
if blackbox_name == "audio_to_text":
|
|
return AudioToText(blackbox_config)
|
|
if blackbox_name == "text_to_audio":
|
|
return TextToAudio(blackbox_config)
|
|
if blackbox_name == "calculator":
|
|
return Calculator(blackbox_config)
|
|
if blackbox_name == "asr":
|
|
return self.asr
|
|
if blackbox_name == "tts":
|
|
return self.tts
|
|
if blackbox_name == "sentiment_engine":
|
|
return self.sentiment
|
|
raise ValueError("Invalid blockbox type") |