-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
apps/setting/models_provider/impl/local_model_provider/credential/tts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# coding=utf-8 | ||
|
||
from typing import Dict | ||
|
||
from common.forms import BaseForm | ||
from setting.models_provider.base_model_provider import BaseModelCredential | ||
|
||
|
||
class BrowserTextToSpeechCredential(BaseForm, BaseModelCredential): | ||
|
||
def is_valid(self, model_type: str, model_name, model_credential: Dict[str, object], provider, | ||
raise_exception=False): | ||
return True | ||
|
||
def encryption_dict(self, model: Dict[str, object]): | ||
return model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apps/setting/models_provider/impl/local_model_provider/model/tts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Dict | ||
|
||
from setting.models_provider.base_model_provider import MaxKBBaseModel | ||
from setting.models_provider.impl.base_tts import BaseTextToSpeech | ||
|
||
|
||
|
||
class BrowserTextToSpeech(MaxKBBaseModel, BaseTextToSpeech): | ||
model: str | ||
|
||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self.model = kwargs.get('model') | ||
|
||
@staticmethod | ||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs): | ||
optional_params = {} | ||
if 'max_tokens' in model_kwargs and model_kwargs['max_tokens'] is not None: | ||
optional_params['max_tokens'] = model_kwargs['max_tokens'] | ||
if 'temperature' in model_kwargs and model_kwargs['temperature'] is not None: | ||
optional_params['temperature'] = model_kwargs['temperature'] | ||
return BrowserTextToSpeech( | ||
model=model_name, | ||
**optional_params, | ||
) | ||
|
||
def check_auth(self): | ||
pass | ||
|
||
def text_to_speech(self, text): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters