mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
temp
This commit is contained in:
3
main.py
3
main.py
@ -11,10 +11,11 @@ blackbox_factory = BlackboxFactory()
|
||||
|
||||
@app.post("/")
|
||||
async def blackbox(blackbox_name: Union[str, None] = None, request: Request = None):
|
||||
print(blackbox_name)
|
||||
if not blackbox_name:
|
||||
return await JSONResponse(content={"error": "blackbox_name is required"}, status_code=status.HTTP_400_BAD_REQUEST)
|
||||
try:
|
||||
box = blackbox_factory.create_blackbox(blackbox_name, {})
|
||||
box = blackbox_factory.create_blackbox(blackbox_name)
|
||||
except ValueError:
|
||||
return await JSONResponse(content={"error": "value error"}, status_code=status.HTTP_400_BAD_REQUEST)
|
||||
return await box.fast_api_handler(request)
|
||||
|
||||
@ -12,18 +12,19 @@ class BlackboxFactory:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.tts = TTS()
|
||||
self.asr = ASR("./.env.yaml")
|
||||
self.sentiment = Sentiment()
|
||||
self.sum = SUM()
|
||||
self.calculator = Calculator()
|
||||
self.audio_to_text = AudioToText()
|
||||
self.text_to_audio = TextToAudio()
|
||||
self.tesou = Tesou()
|
||||
#self.asr = ASR("./.env.yaml")
|
||||
#self.sentiment = Sentiment()
|
||||
#self.sum = SUM()
|
||||
#self.calculator = Calculator()
|
||||
#self.audio_to_text = AudioToText()
|
||||
#self.text_to_audio = TextToAudio()
|
||||
#self.tesou = Tesou()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.processing(*args, **kwargs)
|
||||
|
||||
def create_blackbox(self, blackbox_name: str) -> Blackbox:
|
||||
return self.tts
|
||||
if blackbox_name == "audio_to_text":
|
||||
return self.audio_to_text
|
||||
if blackbox_name == "text_to_audio":
|
||||
|
||||
@ -14,7 +14,6 @@ class TTS(Blackbox):
|
||||
'catmaid': ['resources/tts/models/catmix.json', 'resources/tts/models/catmix_107k.pth', 'character_catmaid', 1.2]
|
||||
}
|
||||
self.tts_service = TTService(*config['catmaid'])
|
||||
super().__init__(config)
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.processing(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user