Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Python SDK for Yandex SpeechKit API. This SDK allows you to use the cloud API for speech recognition and synthesis from Yandex.
For more information please visit Yandex Speechkit API Docs. This lib supports short and long audio recognition with speechkit
Assuming that you have Python and virtualenv
installed, set up your environment and install the required dependencies
like this, or you can install the library using pip
:
$ git clone https://github.com/TikhonP/yandex-speechkit-lib-python.git
$ cd yandex-speechkit-lib-python
$ virtualenv venv
...
$ . venv/bin/activate
$ python -m pip install -r requirements.txt
$ python -m pip install .
python -m pip install speechkit
Check out speechkit docs for more info. PDF docs
There are support of recognizing long and short audio and synthesis. For more information please read docs below.
First you need create session for authorisation:
from speechkit import Session
oauth_token = str('<oauth_token>')
folder_id = str('<folder_id>')
api_key = str('<api-key>')
jwt_token = str('<jwt_token>')
oauth_session = Session.from_yandex_passport_oauth_token(oauth_token, folder_id)
api_key_session = Session.from_api_key(api_key, x_client_request_id_header=True, x_data_logging_enabled=True)
# You can use `x_client_request_id_header` and `x_data_logging_enabled` params to troubleshoot yandex recognition
# Use `Session.get_x_client_request_id()` method to get x_client_request_id value.
jwt_session = Session.from_jwt(jwt_token)
Use created session to make other requests.
There are also functions for getting credentials (read Documentation for more info):
Speechkit.auth.generate_jwt
, speechkit.auth.get_iam_token
, speechkit.auth.get_api_key
Short audio:
from speechkit import ShortAudioRecognition
recognizeShortAudio = ShortAudioRecognition(session)
with open(str('/Users/tikhon/Desktop/out.wav'), str('rb')) as f:
data = f.read()
print(recognizeShortAudio.recognize(data, format='lpcm', sampleRateHertz='48000'))
# Will be printed: 'text that need to be recognized'
Look at example with long audio long_audio_recognition.py .
Look at example with streaming audio streaming_recognize.py
from speechkit import SpeechSynthesis
synthesizeAudio = SpeechSynthesis(session)
synthesizeAudio.synthesize(
str('/Users/tikhon/Desktop/out.wav'), text='Text that will be synthesised',
voice='oksana', format='lpcm', sampleRateHertz='16000'
)
In other words, you can use the code for private and commercial purposes with an author attribution (by including the original license file).
Feel free to contact us via email tikhon.petrishchev@gmail.com.
❤️
FAQs
Python SDK for Yandex Speechkit API.
We found that speechkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.