humanize-e / upload_adapter_to_hf.py
world44's picture
Initial demo files for humanize-e
6595ce6 verified
Raw History Blame Contribute Delete
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()