bhashini-client
bhashini-client is a Python SDK for working with Bhashini inference APIs. The package wraps common pipeline calls behind simple service classes and a unified BhashiniClient, with direct service IDs embedded in each service as requested.
Overview
The SDK currently supports:
- ASR (Automatic Speech Recognition)
- NMT (Neural Machine Translation)
- TTS (Text-to-Speech)
- Transliteration
- Text Language Detection
- OCR
- NER
Each service includes:
- input preprocessing and validation
- hardcoded
serviceIdinside the service implementation - safe postprocessing for clean outputs
- graceful fallback to
"Invalid input"and"API Error"
Installation
pip install .
Usage
from bhashini_client import BhashiniClient
client = BhashiniClient(api_key="your-api-key")
print(client.asr("https://example.com/audio.wav", "hi"))
print(client.nmt("Hello world", "en", "hi"))
print(client.tts("नमस्ते दुनिया", "hi"))
print(client.transliterate("namaste", "en", "hi"))
print(client.detect_language("नमस्ते दुनिया"))
print(client.ocr("https://example.com/page.png", "hi"))
print(client.ner("OpenAI is in Delhi", "en"))
Services
ASR
Transcribes speech from a remote audio URL.
NMT
Translates text from one language to another.
TTS
Generates speech output and returns a usable audio location or content.
Transliteration
Returns transliterated text with suggestions.
Language Detection
Returns the most likely language code and score.
OCR
Extracts text from printed, scene, or handwritten image URLs.
NER
Extracts named entities as a list of {text, label} dictionaries.
Testing Approach
Tests are written with pytest and cover:
- normal cases
- empty input
- whitespace input
- numeric input
- mixed input
- invalid input type
- API failure fallback
Every test prints Test ID, Input, and Output. A test_results.xlsx workbook is generated automatically at the project root after test execution to help track expected versus actual behavior.
Run tests with:
pytest
Release files for bhashini-client 0.2.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 | |
|---|---|---|---|
| bhashini_client-0.2.0.tar.gz | 12.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bhashini_client-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.1 kB
Release files / bhashini_client-0.2.0.tar.gz
| Download URL | bhashini_client-0.2.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c53fea663c013bc8ff3bebb1d7289d7a739672c3e481d2c27541c460ebc1020
|
|
BLAKE2b-256 checksum How to use checksums |
303e7a45a0e7481e6e8d42a602de8ec5806ce84f41280aefd00280046e2e043e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / bhashini_client-0.2.0-py3-none-any.whl
| Download URL | bhashini_client-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
178b1d9a5ce53847186b5653fd57e2d5bd1b10380c1ec30f797056d9866eb14b
|
|
BLAKE2b-256 checksum How to use checksums |
c665ec1092783c8844fde3ea210fd65be21baaba9598209113dd97b4cd40606b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|