This commit is contained in:
superobk
2024-03-27 16:10:46 +08:00
parent 0549a033e1
commit 229501515a
6 changed files with 41 additions and 20 deletions

View File

@ -12,8 +12,8 @@ class BlackboxFactory:
def __init__(self) -> None:
self.tts = TTS()
#self.asr = ASR("./.env.yaml")
#self.sentiment = Sentiment()
self.asr = ASR(".env.yaml")
self.sentiment = Sentiment()
#self.sum = SUM()
#self.calculator = Calculator()
#self.audio_to_text = AudioToText()
@ -24,7 +24,6 @@ class BlackboxFactory:
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":

View File

@ -1,4 +1,5 @@
import io
from ntpath import join
from fastapi import Request, Response, status
from fastapi.responses import JSONResponse
@ -8,12 +9,7 @@ from tts.tts_service import TTService
class TTS(Blackbox):
def __init__(self, *args, **kwargs) -> None:
config = {
'paimon': ['resources/tts/models/paimon6k.json', 'resources/tts/models/paimon6k_390k.pth', 'character_paimon', 1],
'yunfei': ['resources/tts/models/yunfeimix2.json', 'resources/tts/models/yunfeimix2_53k.pth', 'character_yunfei', 1.1],
'catmaid': ['resources/tts/models/catmix.json', 'resources/tts/models/catmix_107k.pth', 'character_catmaid', 1.2]
}
self.tts_service = TTService(*config['catmaid'])
self.tts_service = TTService("catmaid")
def __call__(self, *args, **kwargs):
return self.processing(*args, **kwargs)