MCPcopy
hub / github.com/mudler/LocalAI / analyze

Method analyze

backend/python/speaker-recognition/engines.py:213–228  ·  view source on GitHub ↗
(self, audio_path: str, waveform_16k, actions: Iterable[str])

Source from the content-addressed store, hash-verified

211
212 # --- orchestrator -------------------------------------------------
213 def analyze(self, audio_path: str, waveform_16k, actions: Iterable[str]) -> dict[str, Any]:
214 wanted = {a.strip().lower() for a in actions} if actions else {"age", "gender", "emotion"}
215 result: dict[str, Any] = {}
216 if "age" in wanted or "gender" in wanted:
217 ag = self._infer_age_gender(waveform_16k)
218 if "age" in wanted and "age" in ag:
219 result["age"] = ag["age"]
220 if "gender" in wanted:
221 if "gender" in ag:
222 result["gender"] = ag["gender"]
223 if "dominant_gender" in ag:
224 result["dominant_gender"] = ag["dominant_gender"]
225 if "emotion" in wanted:
226 em = self._infer_emotion(audio_path)
227 result.update(em)
228 return result
229
230
231class SpeechBrainEngine:

Callers 3

VoiceAnalyzeMethod · 0.45
analyzeMethod · 0.45
analyzeMethod · 0.45

Calls 3

_infer_age_genderMethod · 0.95
_infer_emotionMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected