Skip to main content

A wrapper for Yandex SpeechKit API to asyncronously transcribe audio records.

Project description

SpeechKitty

python-package docker-image

SpeechKitty is a wrapper for Yandex SpeechKit API to asyncronously transcribe audio records.

NOTE

It's very initial version of the package. It works perfectly in my case with Asterisk records, but it's not tested in other use cases and with other records so you may want to wait for version 0.2 to try it.

Key features:

  1. Scans directory recursively for wav files.
  2. Applies regex mask to include and exclude certain files.
  3. Skips already transcribed files.
  4. Does all intermediate work like converting and uploading audio files to object storage.
  5. Transcribes and puts json and html files into directory next to audio files.
  6. Can obfuscate html files' names using hash.

Usage

You can use it as a package or a docker container.

Prerequisites

Python Package

  1. Install required ffmpeg library.

  2. Create venv (preferably) and install package.

pip install speechkitty
  1. Download scripts from sample directory at project page:
  1. Fill credentials into credentials.ini

  2. Start transcribing a directory (/mnt/Records in the example below):

export $(grep = credentials.ini | xargs)

python transcribe_directory.py /mnt/Records

Docker Container

  1. Install Docker.

  2. Download project's code from project page on GitHub.

  3. Retrieve credentials from Yandex Cloud and put them into credentials.ini file.

  4. Build docker image. For that open project directory in terminal then type:

docker build -t speechkitty .

Building image may take a while. After it finishes:

  1. Run container. Assuming you have records in /mnt/Records and/or its subdirectories, current directory in terminal is project's directory, and you have credentials.ini file in the sample directory, the command will look like:
grep = sample/credentials.ini > sample/credentials.txt

docker run -i --rm --env-file sample/credentials.txt -v /mnt/Records:/mnt/Records \
speechkitty /bin/bash -c "python sample/transcribe_directory.py /mnt/Records"

Or you can use shell script:

source sample/transcribe_directory.sh /mnt/Records

To name html files using hash of the audio files names, add hash function as a second parameter like that:

source sample/transcribe_directory.sh /mnt/Records md5

This can be useful if records directory is being published using a web server (with option preventing directory listing, of course) and you don't want to reveal names of audio files to prevent files from being downloaded via direct link. So you can put something like SELECT CONCAT(TO_HEX(MD5(recordingfile)), ".html") AS transcript into the DB view to get names of the html files.

Transcribing job may take a while. A good sign that indicates it's working is an appearance of some new json and html files in records directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speechkitty-0.1.6.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

speechkitty-0.1.6-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file speechkitty-0.1.6.tar.gz.

File metadata

  • Download URL: speechkitty-0.1.6.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for speechkitty-0.1.6.tar.gz
Algorithm Hash digest
SHA256 16b606f922d69836968f78cbe88b115285c78562505dd82c9f45c6c1bfecbb56
MD5 57b0ae651c29e3369bb3a572485dd41d
BLAKE2b-256 2723e6f9e64aece7b94fca8b171669199edaa51cc8e1ca8fa1e86218d2f2d988

See more details on using hashes here.

File details

Details for the file speechkitty-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: speechkitty-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for speechkitty-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2285f6da5327b6d00ad0df5ef3a75835dfc435d0badedb62ddc02cb49c7af606
MD5 f5896c78f1583858c3d62e6210572d8f
BLAKE2b-256 56de26156dd6c8473f183abd881d02e97345914237aaf461ec5d2e5196830d2b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page