Autonomous-AI / hf_packager.py
Leonydis137's picture
Create hf_packager.py
faf0927 verified
import uuid
import json
from datetime import datetime
import os
class HFSpacePackager:
def create_snapshot(self, data=None):
snapshot_id = str(uuid.uuid4())
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
filename = f"snapshots/snapshot_{timestamp}_{snapshot_id[:8]}.json"
# Save snapshot to file
os.makedirs("snapshots", exist_ok=True)
with open(filename, "w") as f:
json.dump(data, f, indent=2)
return f"https://huggingface.co/spaces/Leonydis137/Autonomous-AI/snapshots?file={filename}"