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/android/WrapperMain.kt from CIIL/Anuvani-LID: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/CIIL/Anuvani-LID/resolve/main/mobile_inference/tests/android/WrapperMain.kt
- Command line
-
hf download hf://CIIL/Anuvani-LID/mobile_inference/tests/android/WrapperMain.kt
-
curl -L -o WrapperMain.kt https://huggingface.co/CIIL/Anuvani-LID/resolve/main/mobile_inference/tests/android/WrapperMain.kt
1.25 kB
| // Copyright (c) 2026, CIIL Anuvani-LID. Apache-2.0. | |
| // The sample wrapper android/LanguageIdentifier.kt in ART (tests/android/run_on_emulator.sh): identify() on a long | |
| // recording and classify() on clips, printed as the JSON lines of tests/bindings. | |
| package com.example.anuvanilid | |
| import com.k2fsa.sherpa.onnx.WaveReader | |
| import java.io.File | |
| fun main(args: Array<String>) { | |
| val modelDir = File(args[0]) | |
| val accelerator = Accelerator.valueOf(args[1]) | |
| val longWav = args[2] | |
| val work = File(modelDir, "work").apply { mkdirs() } | |
| LanguageIdentifier(modelDir, work, accelerator, threads = 4).use { lid -> | |
| for (path in args.drop(3)) { | |
| val w = WaveReader.readWaveFromFile(path) | |
| val ev = lid.classify(w.samples, w.sampleRate).joinToString(",") { "[\"${it.language}\",-1,${it.probability}]" } | |
| println("{\"file\":\"${File(path).name}\",\"events\":[$ev]}") | |
| } | |
| val w = WaveReader.readWaveFromFile(longWav) | |
| val r = lid.identify(w.samples, w.sampleRate) | |
| println("{\"pipeline_file\":\"${File(longWav).name}\",\"pipeline\":${r.json}}") | |
| System.err.println("wrapper: ${r.language} ${r.confidence} dominant ${r.dominantByTime} ${r.segments.size} segments") | |
| } | |
| } | |