Text2Speech
Text2Speech
Source code in Agent/modules/text_to_speech/text2speech.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
__init__(model_name='openai', to_s3=False)
Initialize the STT object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
The name of the model to use |
'openai'
|
to_s3
|
bool
|
If the audio file should be uploaded to S3 |
False
|
Source code in Agent/modules/text_to_speech/text2speech.py
17 18 19 20 21 22 23 24 25 26 27 28 |
|
handle_task(task)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
Task
|
The task to handle |
required |
Returns:
Type | Description |
---|---|
Task
|
The task with the result |
Source code in Agent/modules/text_to_speech/text2speech.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
text_to_speech_openai(task, task_param)
Convert the text to speech using OpenAI API Args: task (Task): The task to handle task_param (Text2SpeechParameters): The parameters for the task
Returns:
Source code in Agent/modules/text_to_speech/text2speech.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
upload_to_s3(file_path, s3_key)
staticmethod
Upload the file to S3 Args: file_path (str): The path to the file s3_key (str): The key to use in S3
Source code in Agent/modules/text_to_speech/text2speech.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|