Name | salute-speech JSON |
Version |
1.2.4
JSON |
| download |
home_page | None |
Summary | Sber Salute Speech API |
upload_time | 2024-12-01 18:27:32 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Maxim Moroz <maxim.moroz@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
speech
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Sber Salute Speech Python API
## Speech Recognition API
The `SaluteSpeechClient` provides an easy-to-use interface for transcribing audio files, similar to OpenAI's Whisper API but with async support.
### Installation
```bash
pip install salute_speech
```
### Quick Start
```python
from salute_speech.speech_recognition import SaluteSpeechClient
import asyncio
async def main():
# Initialize the client
client = SaluteSpeechClient(client_credentials="your_credentials_here")
# Open and transcribe an audio file
with open("audio.mp3", "rb") as audio_file:
result = await client.audio.transcriptions.create(
file=audio_file,
language="ru-RU"
)
print(result.text)
# Run the async function
asyncio.run(main())
```
### API Reference
#### SaluteSpeechClient
##### `client.audio.transcriptions.create()`
Creates a transcription for the given audio file.
**Parameters:**
- `file` (BinaryIO): An audio file opened in binary mode
- `language` (str, optional): Language code for transcription. Defaults to "ru-RU"
- `prompt` (str, optional): Optional prompt to guide transcription
- `response_format` (str, optional): Format of the response. Currently only "text" is supported
- `poll_interval` (float, optional): Interval between status checks in seconds. Defaults to 1.0
**Returns:**
- `TranscriptionResponse` object with a `text` field containing the transcribed text
**Example:**
```python
async with open("meeting.mp3", "rb") as audio_file:
result = await client.audio.transcriptions.create(
file=audio_file,
language="ru-RU",
prompt="Important business meeting"
)
print(result.text)
```
### Supported Audio Formats
The service supports the following audio formats:
- PCM_S16LE (WAV)
- OPUS
- MP3
- FLAC
- ALAW
- MULAW
### Error Handling
The client may raise several types of exceptions:
- `TokenRequestError`: Issues with authentication
- `FileUploadError`: Problems during file upload
- `TaskStatusResponseError`: Errors while checking task status
It's recommended to wrap API calls in try-except blocks:
```python
try:
result = await client.audio.transcriptions.create(file=audio_file)
except Exception as e:
print(f"Transcription failed: {str(e)}")
```
## Command line interface
* beware each audio channel is decoded so in many cases downmix to 1 channel is recommended
Usage:
```
salute_speech --help
```
Transcribe video to txt:
```
ffmpeg -i video.mp4 -ac 1 -ar 16000 audio.wav
salute_speech transcribe-audio audio.wav -o transcript.txt
```
Transcribe video to vtt:
```
ffmpeg -i video.mp4 -ac 1 -ar 16000 audio.wav
salute_speech transcribe-audio audio.wav -o transcript.vtt
```
Supported formats:
* txt
* vtt
* srt
* tsv
Raw data
{
"_id": null,
"home_page": null,
"name": "salute-speech",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "speech",
"author": null,
"author_email": "Maxim Moroz <maxim.moroz@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/58/9d/9a02ecbbda0ffb1f9a143245965cdbc8131a9e2395f3c1b5f38f504c4abd/salute_speech-1.2.4.tar.gz",
"platform": null,
"description": "# Sber Salute Speech Python API\n\n## Speech Recognition API\n\nThe `SaluteSpeechClient` provides an easy-to-use interface for transcribing audio files, similar to OpenAI's Whisper API but with async support.\n\n### Installation\n\n```bash\npip install salute_speech\n```\n\n### Quick Start\n\n```python\nfrom salute_speech.speech_recognition import SaluteSpeechClient\nimport asyncio\n\nasync def main():\n # Initialize the client\n client = SaluteSpeechClient(client_credentials=\"your_credentials_here\")\n \n # Open and transcribe an audio file\n with open(\"audio.mp3\", \"rb\") as audio_file:\n result = await client.audio.transcriptions.create(\n file=audio_file,\n language=\"ru-RU\"\n )\n print(result.text)\n\n# Run the async function\nasyncio.run(main())\n```\n\n### API Reference\n\n#### SaluteSpeechClient\n\n##### `client.audio.transcriptions.create()`\n\nCreates a transcription for the given audio file.\n\n**Parameters:**\n- `file` (BinaryIO): An audio file opened in binary mode\n- `language` (str, optional): Language code for transcription. Defaults to \"ru-RU\"\n- `prompt` (str, optional): Optional prompt to guide transcription\n- `response_format` (str, optional): Format of the response. Currently only \"text\" is supported\n- `poll_interval` (float, optional): Interval between status checks in seconds. Defaults to 1.0\n\n**Returns:**\n- `TranscriptionResponse` object with a `text` field containing the transcribed text\n\n**Example:**\n```python\nasync with open(\"meeting.mp3\", \"rb\") as audio_file:\n result = await client.audio.transcriptions.create(\n file=audio_file,\n language=\"ru-RU\",\n prompt=\"Important business meeting\"\n )\n print(result.text)\n```\n\n### Supported Audio Formats\n\nThe service supports the following audio formats:\n- PCM_S16LE (WAV)\n- OPUS\n- MP3\n- FLAC\n- ALAW\n- MULAW\n\n### Error Handling\n\nThe client may raise several types of exceptions:\n- `TokenRequestError`: Issues with authentication\n- `FileUploadError`: Problems during file upload\n- `TaskStatusResponseError`: Errors while checking task status\n\nIt's recommended to wrap API calls in try-except blocks:\n\n```python\ntry:\n result = await client.audio.transcriptions.create(file=audio_file)\nexcept Exception as e:\n print(f\"Transcription failed: {str(e)}\")\n```\n\n## Command line interface \n* beware each audio channel is decoded so in many cases downmix to 1 channel is recommended\n\nUsage:\n```\nsalute_speech --help\n```\n\nTranscribe video to txt:\n```\nffmpeg -i video.mp4 -ac 1 -ar 16000 audio.wav\nsalute_speech transcribe-audio audio.wav -o transcript.txt\n```\n\nTranscribe video to vtt:\n```\nffmpeg -i video.mp4 -ac 1 -ar 16000 audio.wav\nsalute_speech transcribe-audio audio.wav -o transcript.vtt\n```\n\nSupported formats:\n * txt\n * vtt\n * srt\n * tsv\n\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Maxim Moroz <maxim.moroz@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Sber Salute Speech API",
"version": "1.2.4",
"project_urls": {
"Homepage": "https://github.com/mmua/salute_speech",
"Repository": "https://github.com/mmua/salute_speech.git"
},
"split_keywords": [
"speech"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e2fe91ad234907f44daf5ebd9351100a95431fd056a8404d3469c2e0fd933c8d",
"md5": "4e3a66e3d8268febf041d8b7984821a4",
"sha256": "6f3c39091662ed404837e438af5abc40db4eb0dcf53e7aadaadced44cf98f7e8"
},
"downloads": -1,
"filename": "salute_speech-1.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e3a66e3d8268febf041d8b7984821a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21285,
"upload_time": "2024-12-01T18:27:30",
"upload_time_iso_8601": "2024-12-01T18:27:30.967774Z",
"url": "https://files.pythonhosted.org/packages/e2/fe/91ad234907f44daf5ebd9351100a95431fd056a8404d3469c2e0fd933c8d/salute_speech-1.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "589d9a02ecbbda0ffb1f9a143245965cdbc8131a9e2395f3c1b5f38f504c4abd",
"md5": "62ee43b56ea5fbbd98d0e6643a184314",
"sha256": "27d670b5ded1a8d2bdea95268a2931770779c8ccc831be5c87095452628ea635"
},
"downloads": -1,
"filename": "salute_speech-1.2.4.tar.gz",
"has_sig": false,
"md5_digest": "62ee43b56ea5fbbd98d0e6643a184314",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20814,
"upload_time": "2024-12-01T18:27:32",
"upload_time_iso_8601": "2024-12-01T18:27:32.216739Z",
"url": "https://files.pythonhosted.org/packages/58/9d/9a02ecbbda0ffb1f9a143245965cdbc8131a9e2395f3c1b5f38f504c4abd/salute_speech-1.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-01 18:27:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mmua",
"github_project": "salute_speech",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "salute-speech"
}