Spaces:
Configuration error
Configuration error
Download upload_adapter_to_hf.py from world44/humanize-e: direct link, hf CLI and curl.
- Browser
- Download file 945 Bytes
-
https://huggingface.co/spaces/world44/humanize-e/resolve/main/upload_adapter_to_hf.py
- Command line
-
hf download hf://spaces/world44/humanize-e/upload_adapter_to_hf.py
-
curl -L -o upload_adapter_to_hf.py https://huggingface.co/spaces/world44/humanize-e/resolve/main/upload_adapter_to_hf.py
945 Bytes
| #!/usr/bin/env python3 | |
| """ | |
| Upload humanize-e LoRA adapter to HuggingFace Hub. | |
| Requires HF_TOKEN env var or huggingface-cli login. | |
| """ | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import HfApi, upload_folder | |
| REPO_ID = os.getenv("HF_REPO_ID", "mike-elistra/humanize-e-adapter") | |
| ADAPTER_DIR = os.getenv("HUMANIZE_ADAPTER", "./humanize-e-adapter") | |
| def main(): | |
| adapter_path = Path(ADAPTER_DIR) | |
| if not adapter_path.exists() or not any(adapter_path.iterdir()): | |
| print(f"Adapter directory {adapter_path} is empty or missing. Nothing to upload.") | |
| return | |
| print(f"Uploading {adapter_path} to {REPO_ID} ...") | |
| upload_folder( | |
| folder_path=str(adapter_path), | |
| repo_id=REPO_ID, | |
| repo_type="model", | |
| commit_message="Upload humanize-e LoRA adapter", | |
| ) | |
| print("Upload complete.") | |
| print(f"Run with: HUMANIZE_ADAPTER={REPO_ID} python app.py") | |
| if __name__ == "__main__": | |
| main() | |