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
File size: 1,251 Bytes
bd48fd1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // 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")
}
}
|