from pathlib import Path from huggingface_hub import HfApi # Configuration REPO_ID = "snow2357/tts-server" # Your Hugging Face Space repo ID REPO_TYPE = "space" # Since this is a Space, type is "space" LOCAL_DIR = Path(__file__).resolve().parent def main(): print(f"Initializing Hugging Face API client...") api = HfApi() print(f"Preparing to upload folder '{LOCAL_DIR}' to Space '{REPO_ID}'...") # Upload the entire folder contents to the Space repository api.upload_folder( folder_path=str(LOCAL_DIR), repo_id=REPO_ID, repo_type=REPO_TYPE, ignore_patterns=[ "__pycache__/*", "*.pyc", ".git/*", ".venv/*", ".gradio/*", "outputs/*", ], # Ignores cache, virtual environments, and local temp audio outputs commit_message="Update TTS server backend and model weights via upload script", ) print( f"Successfully uploaded everything to https://huggingface.co/spaces/{REPO_ID}!" ) if __name__ == "__main__": main()