Skip to main content

Minimal Python client for the tomfun speech-to-text web API (token auth, language hint).

Project description

tomfun-speech-to-text-client

Minimal async Python client for the tomfun speech-to-text web API.

  • Token authentication (Authorization: Bearer <token>)
  • Language hint passed to Whisper
  • Upload local files (chunked) or submit a remote URL
  • Streams status via Server-Sent Events

Single runtime dependency: aiohttp.

Install

pip install tomfun-speech-to-text-client

Usage

import asyncio
from tomfun_speech_to_text_client import Client

async def main():
    async with Client("https://speech-to-text.tomfun.co", token="YOUR_TOKEN") as c:
        r = await c.transcribe_file("audio.mp3", language="en")
        print(r.text)

        r = await c.transcribe_url("https://example.com/clip.wav", language="uk")
        print(r.srt)

asyncio.run(main())

With progress callback:

async def on_status(ev):
    print(ev["status"], ev.get("progressLast"))

await c.transcribe_file("audio.mp3", language="en", on_status=on_status)

Cancel a job:

await c.cancel(job_id)

Development (uv)

cd python_client
uv sync --group dev
uv run pytest

Publishing to PyPI

  1. Create a PyPI API token at https://pypi.org/manage/account/token/.
  2. Bump version in pyproject.toml.
  3. Build:
    uv build
    
  4. Upload:
    uv publish --token "$PYPI_TOKEN"
    
    Or via twine:
    uv tool run --with twine twine upload dist/*
    

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

tomfun_speech_to_text_client-0.0.3.tar.gz (95.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tomfun_speech_to_text_client-0.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file tomfun_speech_to_text_client-0.0.3.tar.gz.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.3.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2095773e3d28d97a493e9281402132d4e7a9b7661402f09baf92e292080d9e61
MD5 c984ac9667fbc70208a9445cd3d0a497
BLAKE2b-256 ab44235627ee7936f566612283eeed189edea73690bdfd2d21b7d71cb5790ace

See more details on using hashes here.

File details

Details for the file tomfun_speech_to_text_client-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd81c51cec3153bd8ef21ff5411faed65a4e77e9fac708ef8062cee93688be8
MD5 1488799bbff6a2080e43f4b6f73ab568
BLAKE2b-256 21a74cdd8f28f6afb169ae52d58c68e1d157f52ae778f28431f99aed66de3f11

See more details on using hashes here.

Supported by

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