File size: 722 Bytes
5da0109
 
 
 
 
 
 
 
 
 
 
 
dae9fa5
5da0109
 
dae9fa5
 
5da0109
 
dae9fa5
5da0109
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
# SPDX-License-Identifier: Apache-2.0
#

from config import HF_TOKEN
from huggingface_hub import login

def authenticate_huggingface():
    if HF_TOKEN:
        try:
            login(token=HF_TOKEN, add_to_git_credential=False)
            print("Authenticated with Hugging Face", flush=True)

        except Exception as authentication_error:
            print(f"Hugging Face authentication failed: {authentication_error}", flush=True)
            print("Voice cloning may not be available", flush=True)

    else:
        print("Missing Hugging Face authentication required for the license agreement", flush=True)

def get_huggingface_token():
    return HF_TOKEN