Daspeak client docs
vericlient.daspeak.client.DaspeakClient
¶
Bases: Client
Class to interact with the Daspeak API.
Source code in src/vericlient/daspeak/client.py
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
|
__init__(apikey=None, timeout=None, environment=None, location=None, url=None, headers=None)
¶
Create the DaspeakClient class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
apikey |
str | None
|
The API key to use |
None
|
timeout |
int | None
|
The timeout to use in the requests |
None
|
environment |
str | None
|
The environment to use |
None
|
location |
str | None
|
The location to use |
None
|
url |
str | None
|
The URL to use in case of a custom target |
None
|
headers |
dict | None
|
The headers to be used in the requests |
None
|
Source code in src/vericlient/daspeak/client.py
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 104 105 106 |
|
alive()
¶
Check if the service is alive.
Returns bool: True if the service is alive, False otherwise
Source code in src/vericlient/daspeak/client.py
108 109 110 111 112 113 114 115 116 117 |
|
compare(data_model)
¶
Compare two sets of data based on the provided input.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_model |
CompareCredential2AudioInput | CompareAudio2AudioInput | CompareCredential2CredentialInput | CompareAudio2CredentialsInput | CompareCredential2CredentialsInput
|
The data required to compare the audio files or credentials |
required |
Returns:
Type | Description |
---|---|
CompareCredential2AudioOutput | CompareAudio2AudioOutput | CompareCredential2CredentialOutput | CompareAudio2CredentialsOutput | CompareCredential2CredentialsOutput
|
The response from the service, depending on the input type. |
Raises:
Type | Description |
---|---|
ValueError
|
If the |
TooManyAudioChannelsError
|
If the audio has more channels than the service supports |
UnsupportedAudioCodecError
|
If the audio has an unsupported codec |
UnsupportedSampleRateError
|
If the audio has an unsupported sample rate |
AudioDurationTooLongError
|
If the audio duration is longer than the service supports |
SignalNoiseRatioError
|
If the signal-to-noise ratio is too low |
NetSpeechDurationIsNotEnoughError
|
If the net speech duration is not enough |
InvalidSpecifiedChannelError
|
If the specified channel is invalid |
InsufficientQualityError
|
If the audio quality is insufficient |
CalibrationNotAvailableError
|
If the calibration is not available |
InvalidCredentialError
|
If the credential is invalid |
UnsupportedMediaTypeError
|
If the media type is not supported |
Source code in src/vericlient/daspeak/client.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
generate_credential(data_model)
¶
Generate a credential from a WAV file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_model |
GenerateCredentialInput
|
The data required to generate the credential |
required |
Returns:
Type | Description |
---|---|
GenerateCredentialOutput
|
The response from the service |
Raises:
Type | Description |
---|---|
ValueError
|
If the |
TooManyAudioChannelsError
|
If the audio has more channels than the service supports |
UnsupportedAudioCodecError
|
If the audio has an unsupported codec |
UnsupportedSampleRateError
|
If the audio has an unsupported sample rate |
AudioDurationTooLongError
|
If the audio duration is longer than the service supports |
SignalNoiseRatioError
|
If the signal-to-noise ratio is too low |
NetSpeechDurationIsNotEnoughError
|
If the net speech duration is not enough |
InvalidSpecifiedChannelError
|
If the specified channel is invalid |
InsufficientQualityError
|
If the audio quality is insufficient |
CalibrationNotAvailableError
|
If the calibration is not available |
UnsupportedMediaTypeError
|
If the media type is not supported |
Source code in src/vericlient/daspeak/client.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
get_models()
¶
Get the models available biometrics models in the service.
Returns:
Type | Description |
---|---|
ModelsOutput
|
The response from the service |
Source code in src/vericlient/daspeak/client.py
152 153 154 155 156 157 158 159 160 |
|
vericlient.daspeak.models
¶
Module to define the models for the Daspeak API.
CompareAudio2AudioInput
¶
Bases: CompareInput
Input class for the similarity audio to audio endpoint.
Attributes:
Name | Type | Description |
---|---|---|
audio_reference |
str | bytes
|
The reference audio. It can be a path to a file or a bytes object with the audio content |
audio_to_evaluate |
str | bytes
|
The audio to evaluate. It can be a path to a file or a bytes object with the audio content |
channel_reference |
int
|
The |
channel_to_evaluate |
int
|
The |
Source code in src/vericlient/daspeak/models.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
CompareAudio2AudioOutput
¶
Bases: CompareOutput
Output class for the similarity audio to audio endpoint.
Attributes:
Name | Type | Description |
---|---|---|
model |
ModelMetadata
|
The model used to generate the credential |
calibration |
str
|
The calibration used |
authenticity_reference |
float
|
The authenticity of the reference audio sample |
authenticity_to_evaluate |
float
|
The authenticity of the audio to evaluate |
input_audio_duration_reference |
float
|
The duration of the reference audio |
input_audio_duration_to_evaluate |
float
|
The duration of the audio to evaluate |
net_speech_duration_reference |
float
|
The duration of the speech in the reference audio |
net_speech_duration_to_evaluate |
float
|
The duration of the speech in the audio to evaluate |
Source code in src/vericlient/daspeak/models.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
CompareAudio2CredentialsInput
¶
Bases: CompareInput
Input class for the identification audio to credentials endpoint.
Attributes:
Name | Type | Description |
---|---|---|
audio_reference |
str | bytes
|
The audio to evaluate. It can be a path to a file or a bytes object with the audio content |
credential_list |
list[tuple[str, str]]
|
The credentials to compare the audio with. The list contains touples with two strings: the id and the credential |
channel |
int
|
The |
Source code in src/vericlient/daspeak/models.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
CompareAudio2CredentialsOutput
¶
Bases: DaspeakResponse
Output class for the identification audio to credentials endpoint.
Attributes:
Name | Type | Description |
---|---|---|
result |
dict
|
The result of the identification, a dictionary with the "id" and the "score" of the best match |
scores |
list[dict]
|
The whole list of scores for each credential. The list contains dictionaries with two keys (and values): "id" and "score" |
calibration |
str
|
The calibration used |
model |
ModelMetadata
|
The model used to generate the credential |
authenticity_reference |
float
|
The authenticity of the reference audio sample |
input_audio_duration_reference |
float
|
The duration of the input audio |
net_speech_duration_reference |
float
|
The duration of the speech in the audio |
Source code in src/vericlient/daspeak/models.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|
CompareCredential2AudioInput
¶
Bases: CompareInput
Input class for the similarity credential to audio endpoint.
Attributes:
Name | Type | Description |
---|---|---|
credential_reference |
str
|
The reference credential |
audio_to_evaluate |
str | bytes
|
The audio to evaluate. It can be a path to a file or a bytes object with the audio content |
channel |
int
|
The |
Source code in src/vericlient/daspeak/models.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
CompareCredential2AudioOutput
¶
Bases: CompareOutput
Output class for the similarity credential to audio endpoint.
Attributes:
Name | Type | Description |
---|---|---|
model |
ModelMetadata
|
The model used to generate the credential |
calibration |
str
|
The calibration used |
authenticity_to_evaluate |
float
|
The authenticity of the audio sample used |
input_audio_duration |
float
|
The duration of the input audio |
net_speech_duration |
float
|
The duration of the speech in the audio |
Source code in src/vericlient/daspeak/models.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
CompareCredential2CredentialInput
¶
Bases: CompareInput
Input class for the similarity credential to credential endpoint.
Attributes:
Name | Type | Description |
---|---|---|
credential_reference |
str
|
The reference credential |
credential_to_evaluate |
str
|
The credential to evaluate |
calibration |
str
|
The calibration to use |
Source code in src/vericlient/daspeak/models.py
122 123 124 125 126 127 128 129 130 131 132 133 |
|
CompareCredential2CredentialOutput
¶
Bases: CompareOutput
Output class for the similarity credential to credential endpoint.
Attributes:
Name | Type | Description |
---|---|---|
calibration |
str
|
The calibration used |
Source code in src/vericlient/daspeak/models.py
136 137 138 139 140 141 142 143 144 |
|
CompareCredential2CredentialsInput
¶
Bases: CompareInput
Input class for the identification credential to credentials endpoint.
Attributes:
Name | Type | Description |
---|---|---|
credential_reference |
str
|
The reference credential |
credential_list |
list[tuple[str, str]]
|
The credentials to compare the audio with. The list contains touples with two strings: the id and the credential |
Source code in src/vericlient/daspeak/models.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
CompareCredential2CredentialsOutput
¶
Bases: DaspeakResponse
Output class for the identification credential to credentials endpoint.
Attributes:
Name | Type | Description |
---|---|---|
result |
dict
|
The result of the identification, a dictionary with the "id" and the "score" of the best match |
scores |
list[dict]
|
The whole list of scores for each credential. The list contains dictionaries with two keys (and values): "id" and "score" |
calibration |
str
|
The calibration used |
model |
str
|
The model used to generate the credential |
Source code in src/vericlient/daspeak/models.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
CompareInput
¶
Bases: BaseModel
Base class for the similarity inputs.
Attributes:
Name | Type | Description |
---|---|---|
calibration |
str
|
The calibration to use |
Source code in src/vericlient/daspeak/models.py
96 97 98 99 100 101 102 103 104 |
|
CompareOutput
¶
Bases: DaspeakResponse
Base class for the similarity outputs.
Attributes:
Name | Type | Description |
---|---|---|
score |
float
|
The similarity score between the two inputs |
Source code in src/vericlient/daspeak/models.py
107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
DaspeakResponse
¶
Bases: BaseModel
Base class for the Daspeak API responses.
Attributes:
Name | Type | Description |
---|---|---|
version |
str
|
The version of the API |
status_code |
int
|
The status code of the response |
Source code in src/vericlient/daspeak/models.py
7 8 9 10 11 12 13 14 15 16 17 |
|
GenerateCredentialInput
¶
Bases: BaseModel
Input class for the generate credential endpoint.
Attributes:
Name | Type | Description |
---|---|---|
audio |
str | bytes
|
The audio to generate the credential with. It can be a path to a file or a bytes object with the audio content |
hash |
str
|
The hash of the biometrics model to use |
channel |
int
|
The |
calibration |
str
|
The calibration to use |
Source code in src/vericlient/daspeak/models.py
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 |
|
GenerateCredentialOutput
¶
Bases: DaspeakResponse
Output class for the generate credential endpoint.
Attributes:
Name | Type | Description |
---|---|---|
model |
ModelMetadata
|
The model used to generate the credential |
credential |
str
|
The generated credential |
authenticity |
float
|
The authenticity of the audio sample used |
input_audio_duration |
float
|
The duration of the input audio |
net_speech_duration |
float
|
The duration of the speech in the audio |
Source code in src/vericlient/daspeak/models.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
ModelMetadata
¶
Bases: BaseModel
Metadata of the model used to generate the credential.
Attributes:
Name | Type | Description |
---|---|---|
hash |
str
|
The hash of the model |
mode |
str
|
The mode of the model |
Source code in src/vericlient/daspeak/models.py
60 61 62 63 64 65 66 67 68 69 70 |
|
ModelsOutput
¶
Bases: DaspeakResponse
Output class for the get models endpoint.
Attributes:
Name | Type | Description |
---|---|---|
models |
list
|
The available models in the service |
Source code in src/vericlient/daspeak/models.py
20 21 22 23 24 25 26 27 28 |
|
vericlient.daspeak.exceptions
¶
Module to define the exceptions for the Daspeak API.
AudioDurationTooLongError
¶
Bases: AudioInputError
Exception raised for audio duration too long.
Source code in src/vericlient/daspeak/exceptions.py
35 36 37 38 39 40 |
|
AudioInputError
¶
Bases: DaspeakError
Exception raised for errors in the audio input.
Source code in src/vericlient/daspeak/exceptions.py
12 13 14 15 16 |
|
CalibrationNotAvailableError
¶
Bases: DaspeakError
Exception raised for calibration not available.
Source code in src/vericlient/daspeak/exceptions.py
86 87 88 89 90 91 |
|
DaspeakError
¶
Bases: VeriClientError
Base class for exceptions in the Daspeak API.
Source code in src/vericlient/daspeak/exceptions.py
5 6 7 8 9 |
|
InsufficientQualityError
¶
Bases: DaspeakError
Exception raised for insufficient quality.
Source code in src/vericlient/daspeak/exceptions.py
78 79 80 81 82 83 |
|
InvalidSpecifiedChannelError
¶
Bases: DaspeakError
Exception raised for invalid specified channel.
Source code in src/vericlient/daspeak/exceptions.py
70 71 72 73 74 75 |
|
NetSpeechDurationIsNotEnoughError
¶
Bases: DaspeakError
Exception raised for errors in the net speech duration.
Source code in src/vericlient/daspeak/exceptions.py
59 60 61 62 63 64 65 66 67 |
|
SignalNoiseRatioError
¶
Bases: DaspeakError
Exception raised for errors in the signal noise ratio.
Source code in src/vericlient/daspeak/exceptions.py
51 52 53 54 55 56 |
|
TooManyAudioChannelsError
¶
Bases: AudioInputError
Exception raised for too many audio channels.
Source code in src/vericlient/daspeak/exceptions.py
19 20 21 22 23 24 |
|
UnsupportedAudioCodecError
¶
Bases: AudioInputError
Exception raised for unsupported audio codec.
Source code in src/vericlient/daspeak/exceptions.py
43 44 45 46 47 48 |
|
UnsupportedSampleRateError
¶
Bases: AudioInputError
Exception raised for unsupported sample rates.
Source code in src/vericlient/daspeak/exceptions.py
27 28 29 30 31 32 |
|