Nathyboy commited on
Commit
addf675
·
1 Parent(s): cda38f2

Create auto_frame_sync.py

Browse files
Files changed (1) hide show
  1. auto_frame_sync.py +26 -0
auto_frame_sync.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import shutil
2
+ import glob
3
+ import os
4
+ import time
5
+
6
+ # Temporary Deforum frame output
7
+ temp_frames = "stable-diffusion-webui/deforum/output_temp/frames"
8
+ # Persistent folder in repo
9
+ persistent_frames = "stable-diffusion-webui/deforum/output_committed/frames"
10
+
11
+ # Ensure persistent folder exists
12
+ os.makedirs(persistent_frames, exist_ok=True)
13
+
14
+ print("🟢 Auto Frame Sync started...")
15
+
16
+ # Loop forever (or until the Space stops)
17
+ while True:
18
+ # Copy any new frames
19
+ for frame_file in glob.glob(os.path.join(temp_frames, "*.png")):
20
+ dest_file = os.path.join(persistent_frames, os.path.basename(frame_file))
21
+ if not os.path.exists(dest_file):
22
+ shutil.copy(frame_file, dest_file)
23
+ print(f"✅ Copied {os.path.basename(frame_file)}")
24
+
25
+ # Wait a few seconds before checking again
26
+ time.sleep(5)