Views
No views yet
| Feature | Description |
|---|---|
| Multilingual | Supports 13+ languages |
| Translation | Translate speech directly to English text |
| Custom prompting | Guide recognition with domain-specific context |
| Streaming | Real-time token-by-token output |
pip install -U mlx-audio-plus1from mlx_audio.stt.models.funasr import Model
2
3# Load the model
4model = Model.from_pretrained("mlx-community/Fun-ASR-Nano-2512-4bit")
5
6# Transcribe audio
7result = model.generate("audio.wav")
8print(result.text)
9# Output: "The quick brown fox jumps over the lazy dog."
10
11print(f"Duration: {result.duration:.2f}s")
12print(f"Language: {result.language}")1# Translate Chinese/Japanese/etc. audio to English
2result = model.generate(
3 "chinese_speech.wav",
4 task="translate",
5 target_language="en"
6)
7print(result.text) # English translation1# Medical transcription
2result = model.generate(
3 "doctor_notes.wav",
4 initial_prompt="Medical consultation discussing cardiac symptoms and treatment options."
5)
6
7# Technical content
8result = model.generate(
9 "tech_podcast.wav",
10 initial_prompt="Discussion about machine learning, APIs, and software development."
11)1# Print tokens as they're generated
2result = model.generate("audio.wav", verbose=True)
3# Tokens stream to stdout in real-time
4
5# Or use the streaming generator
6for chunk in model.generate("audio.wav", stream=True):
7 print(chunk, end="", flush=True)