Spaces:
Sleeping
Sleeping
| import shutil | |
| import glob | |
| import os | |
| import time | |
| # Temporary Deforum frame output | |
| temp_frames = "stable-diffusion-webui/deforum/output_temp/frames" | |
| # Persistent folder in repo | |
| persistent_frames = "stable-diffusion-webui/deforum/output_committed/frames" | |
| # Ensure persistent folder exists | |
| os.makedirs(persistent_frames, exist_ok=True) | |
| print("π’ Auto Frame Sync started...") | |
| # Loop forever (or until the Space stops) | |
| while True: | |
| # Copy any new frames | |
| for frame_file in glob.glob(os.path.join(temp_frames, "*.png")): | |
| dest_file = os.path.join(persistent_frames, os.path.basename(frame_file)) | |
| if not os.path.exists(dest_file): | |
| shutil.copy(frame_file, dest_file) | |
| print(f"β Copied {os.path.basename(frame_file)}") | |
| # Wait a few seconds before checking again | |
| time.sleep(5) | |