Models Reference
Classes:
Name | Description |
---|---|
AudioFormat |
List of audio formats accepted by Flowery. |
FloweryAPIConfig |
Configuration used when making requests to the Flowery API. |
Language |
Language object returned from the Flowery API. |
TTSResponse |
Object containing data from a TTS query. |
Voice |
Voice object returned from the Flowery API. |
AudioFormat
List of audio formats accepted by Flowery.
Attributes:
Name | Type | Description |
---|---|---|
AAC |
AAC audio format. |
|
FLAC |
FLAC audio format. |
|
MP3 |
MP3 audio format. |
|
OPUS |
||
VORBIS |
||
WAV |
WAV audio format. |
Source code in pyflowery/models.py
FloweryAPIConfig
Bases: BaseModel
Configuration used when making requests to the Flowery API.
Example
Attributes:
Name | Type | Description |
---|---|---|
allow_truncation |
bool
|
Whether to allow truncation of text that is too long. |
base_url |
str
|
The base url for the Flowery API. |
interval |
int
|
Seconds to wait between each retried request, multiplied by how many attempted requests have been made. |
logger |
Logger
|
Logger to use for logging messages. One will be automatically created if not provided here. |
prepended_user_agent |
str
|
Return the user_agent with the PyFlowery module version prepended. |
retry_limit |
int
|
Number of times to retry a request before giving up. |
token |
str | None
|
Authorization token to use in HTTP requests. Authorization is only required if you want increased ratelimits. |
user_agent |
str
|
User-Agent string to use im HTTP requests. Required as of 2.1.0. |
Source code in pyflowery/models.py
allow_truncation = False
class-attribute
instance-attribute
Whether to allow truncation of text that is too long.
base_url = 'https://api.flowery.pw/v1'
class-attribute
instance-attribute
The base url for the Flowery API.
interval = 5
class-attribute
instance-attribute
Seconds to wait between each retried request, multiplied by how many attempted requests have been made.
logger = Field(default_factory=_create_logger)
class-attribute
instance-attribute
Logger to use for logging messages. One will be automatically created if not provided here.
prepended_user_agent
property
Return the user_agent with the PyFlowery module version prepended.
retry_limit = 3
class-attribute
instance-attribute
Number of times to retry a request before giving up.
token = None
class-attribute
instance-attribute
Authorization token to use in HTTP requests. Authorization is only required if you want increased ratelimits.
See the Flowery API documentation for more details.
user_agent
instance-attribute
User-Agent string to use im HTTP requests. Required as of 2.1.0.
Language
Bases: BaseModel
Language object returned from the Flowery API.
Attributes:
Name | Type | Description |
---|---|---|
code |
str
|
The code associated with the language. |
name |
str | None
|
The name associated with the language. |
Source code in pyflowery/models.py
code
instance-attribute
The code associated with the language.
name = None
class-attribute
instance-attribute
The name associated with the language.
TTSResponse
Bases: BaseModel
Object containing data from a TTS query.
Attributes:
Name | Type | Description |
---|---|---|
audio_format |
AudioFormat
|
What format the data is in. |
data |
bytes
|
The synthesized TTS data in bytes. |
silence |
timedelta
|
How long the empty space before the audio starts is. Supported range is 0 - 10 seconds. |
speed |
float
|
How much the audio is sped up or slowed down. Supported range is 0.5 - 10, in increments of 0.1. |
text |
str
|
The text used to generate the TTS data. |
translate |
bool
|
Whether the text was translated into the voice's set language before being synthesized. |
voice |
Voice | None
|
The voice used to generate the TTS data. |
Source code in pyflowery/models.py
audio_format
instance-attribute
What format the data is in.
data
instance-attribute
The synthesized TTS data in bytes.
silence
instance-attribute
How long the empty space before the audio starts is. Supported range is 0 - 10 seconds.
speed = 1.0
class-attribute
instance-attribute
How much the audio is sped up or slowed down. Supported range is 0.5 - 10, in increments of 0.1.
text
instance-attribute
The text used to generate the TTS data.
translate = False
class-attribute
instance-attribute
Whether the text was translated into the voice's set language before being synthesized.
voice = None
class-attribute
instance-attribute
The voice used to generate the TTS data.
Voice
Bases: BaseModel
Voice object returned from the Flowery API.
Attributes:
Name | Type | Description |
---|---|---|
gender |
str
|
Gender of the voice. |
id |
str
|
UUID of the voice. |
language |
Language
|
Which language the voice is meant to be used for. |
name |
str
|
Name of the voice. |
source |
str
|
Which provider the voice comes from. |
Source code in pyflowery/models.py
gender
instance-attribute
Gender of the voice.
id
instance-attribute
UUID of the voice.
language
instance-attribute
Which language the voice is meant to be used for.
name
instance-attribute
Name of the voice.
source
instance-attribute
Which provider the voice comes from.