py-transcribe
Implementation-agnostic framework for synchronous batch text-to-speech transcription with backend services such as AWS, Watson, etc.
This module itself does NOT include a full implementation or an integration with any transcription service. The intention instead is that you include a specific implementation in your project. For example, for AWS Transcribe, use (py-transcribe-aws)[https://github.com/ICTLearningSciences/py-transcribe-aws]
Python Installation
pip install py-transcribe
Usage
You first need to install some concrete implementation of py-transcribe. If you are using AWS, then you can install transcribe-aws like this:
pip install py-transcribe-aws
...once the implementation is installed, you can configure that one of two ways:
Setting the implementation module path
Set ENV var TRANSCRIBE_MODULE_PATH, e.g.
export TRANSCRIBE_MODULE_PATH=transcribe_aws
or pass the module path at service-creation time, e.g.
from transcribe import init_transcription_service
service = init_transcription_service(
module_path="transcribe_aws"
)
Basic usage
Once you're set up, basic usage looks like this:
from transcribe import (
init_transcription_service
TranscribeJobRequest,
TranscribeJobStatus
)
service = init_transcription_service()
result = service.transcribe([
TranscribeJobRequest(
sourceFile="/some/path/j1.wav"
),
TranscribeJobRequest(
sourceFile="/some/other/path/j2.wav"
)
])
for j in result.jobs():
if j.status == TranscribeJoStatus.SUCCEEDED:
print(j.transcript)
else:
print(j.error)
Handling updates on large/long-running batch jobs
The main transcribe method is synchronous to hide the async/polling-based complexity of most transcribe services. But for any non-trivial batch of transcriptions, you probably do want to receive periodic updates, for example to save any completed transcriptions. You can do that by passing an on_update callback as follows:
from transcribe import (
init_transcription_service
TranscribeJobRequest,
TranscribeJobStatus,
TranscribeJobsUpdate
)
service = init_transcription_service()
def _on_update(u: TranscribeJobsUpdate) -> None:
for j in u.jobs():
if j.status == TranscribeJoStatus.SUCCEEDED:
print(f"save result: {j.transcript}")
else:
print(j.error)
result = service.transcribe(
[
TranscribeJobRequest(
sourceFile="/some/path/j1.wav"
),
TranscribeJobRequest(
sourceFile="/some/other/path/j2.wav"
)
],
on_update=_on_update
)
Configuring the environment for your implementation
Most implementations will also require other configuration, which you can either set in your environment or pass to init_transcription_service as config={}. See your implementation docs for details.
Development
Run tests during development with
make test-all
Once ready to release, create a release tag, currently using semver-ish numbering, e.g. 1.0.0(-alpha.1)
Metadata
Release files for py-transcribe 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| py-transcribe-1.5.0.tar.gz | 9.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_transcribe-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / py-transcribe-1.5.0.tar.gz
| Download URL | py-transcribe-1.5.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca270ab4621bc4f7076a14bb757939fa434ac839bfdad9695213288fb60f5807
|
|
BLAKE2b-256 checksum How to use checksums |
775982421a66ffda07460fa4cba22792221d7d861fc0badde7ec1694092c1e4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / py_transcribe-1.5.0-py3-none-any.whl
| Download URL | py_transcribe-1.5.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb0e83b6f03c3adfdea8dd3156897c0d5c0b6e16f1618b00d6980f9dad7853d7
|
|
BLAKE2b-256 checksum How to use checksums |
527f71d2d690c79c06cb27ee64dd306a3d050f4755bac8ee62e0cec89e017261
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for py-transcribe 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.