File size: 584 Bytes
faf0927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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}"