File size: 1,083 Bytes
ebba35f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Patch huggingface_hub to handle deprecated use_auth_token parameter
# This is needed because speechbrain uses the old API
import huggingface_hub
_original_hf_hub_download = huggingface_hub.hf_hub_download

def _patched_hf_hub_download(*args, **kwargs):
    # Convert deprecated use_auth_token to token
    if 'use_auth_token' in kwargs:
        kwargs['token'] = kwargs.pop('use_auth_token')
    return _original_hf_hub_download(*args, **kwargs)

huggingface_hub.hf_hub_download = _patched_hf_hub_download

# Also patch snapshot_download if it exists
if hasattr(huggingface_hub, 'snapshot_download'):
    _original_snapshot_download = huggingface_hub.snapshot_download

    def _patched_snapshot_download(*args, **kwargs):
        if 'use_auth_token' in kwargs:
            kwargs['token'] = kwargs.pop('use_auth_token')
        return _original_snapshot_download(*args, **kwargs)

    huggingface_hub.snapshot_download = _patched_snapshot_download

from .analyzer import AudioAnalyzer, AnalysisResult, SpeakerResult

__all__ = ['AudioAnalyzer', 'AnalysisResult', 'SpeakerResult']