File size: 597 Bytes
37c6d1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"}
        ]
    }