import random def analyze_audio(metadata): # Mock detection logic # In a real app, this would use a model # Deterministic mock based on file size to be consistent for testing if needed, # or just random for demo. Let's make it random but weighted. is_human = random.choice([True, False]) confidence = round(random.uniform(0.70, 0.99), 2) return { "is_human": is_human, "confidence": confidence, "detected_language": "multilingual", "segments": [ {"start": 0.0, "end": 2.5, "label": "speech"} ] }