(self, audio_path: str, waveform_16k, actions: Iterable[str])
| 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 | |
| 231 | class SpeechBrainEngine: |
no test coverage detected