Audio Classification
Transformers
ONNX
NeMo
Safetensors
anuvani_lid
audio
speech
language-identification
spoken-language-id
lid
indic
conformer
custom_code
Instructions to use CIIL/Anuvani-LID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CIIL/Anuvani-LID with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("audio-classification", model="CIIL/Anuvani-LID", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForAudioClassification model = AutoModelForAudioClassification.from_pretrained("CIIL/Anuvani-LID", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download mobile_inference/tests/bindings/python_ref.py from CIIL/Anuvani-LID: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/CIIL/Anuvani-LID/resolve/main/mobile_inference/tests/bindings/python_ref.py
- Command line
-
hf download hf://CIIL/Anuvani-LID/mobile_inference/tests/bindings/python_ref.py
-
curl -L -o python_ref.py https://huggingface.co/CIIL/Anuvani-LID/resolve/main/mobile_inference/tests/bindings/python_ref.py
1.5 kB
| #!/usr/bin/env python3 | |
| # Copyright (c) 2026, CIIL Anuvani-LID. Apache-2.0. | |
| """Reference output of the binding tests, from the sherpa-onnx Python package. Every binding test prints | |
| the same JSON lines for the same inputs: | |
| {"file": <clip>, "events": [[label, index, prob], ...]} AudioTagging, all 23 languages, largest first | |
| {"pipeline_file": <recording>, "pipeline": {...}} LidPipeline JSON of the long recording | |
| python3 tests/bindings/python_ref.py <lid model> <vad model> <long wav> <clip.wav> ... | |
| """ | |
| import json | |
| import os | |
| import sys | |
| import sherpa_onnx | |
| import soundfile as sf | |
| def main(): | |
| model, vad, long_wav, clips = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4:] | |
| tagger = sherpa_onnx.AudioTagging(sherpa_onnx.AudioTaggingConfig( | |
| model=sherpa_onnx.AudioTaggingModelConfig(lid=model, num_threads=2), top_k=23)) | |
| for path in clips: | |
| w, sr = sf.read(path, dtype="float32") | |
| s = tagger.create_stream() | |
| s.accept_waveform(sr, w) | |
| ev = tagger.compute(s) | |
| print(json.dumps({"file": os.path.basename(path), "events": [[e.name, e.index, e.prob] for e in ev]})) | |
| pipe = sherpa_onnx.LidPipeline(sherpa_onnx.LidPipelineConfig( | |
| model=sherpa_onnx.AudioTaggingModelConfig(lid=model, num_threads=2), vad_model=vad)) | |
| w, sr = sf.read(long_wav, dtype="float32") | |
| print(json.dumps({"pipeline_file": os.path.basename(long_wav), "pipeline": json.loads(pipe.process(w, sr))})) | |
| if __name__ == "__main__": | |
| main() | |