Spaces:
Sleeping
Sleeping
| # | |
| # 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 |