import os from huggingface_hub import HfApi HF_TOKEN = os.getenv("HF_TOKEN") REPO_ID = "basyx/music-storage" api = HfApi() def upload_audio(filepath): if not HF_TOKEN: return None filename = os.path.basename(filepath) api.upload_file( path_or_fileobj=filepath, path_in_repo=filename, repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN ) return f"https://huggingface.co/datasets/{REPO_ID}/resolve/main/{filename}"