AItool commited on
Commit
b2946a9
·
verified ·
1 Parent(s): b7f5864

clear output

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -14,6 +14,15 @@ OUTPUT_GIF = Path(TARGET_DIR) / "output.gif"
14
  os.makedirs(TARGET_DIR, exist_ok=True)
15
 
16
  def interpolate_image(img_a_path: str, img_b_path: str) -> str:
 
 
 
 
 
 
 
 
 
17
  # 1) Run inference to generate frames into TARGET_DIR/img%d.png
18
  subprocess.run([
19
  "python3", "inference_img.py",
 
14
  os.makedirs(TARGET_DIR, exist_ok=True)
15
 
16
  def interpolate_image(img_a_path: str, img_b_path: str) -> str:
17
+ # --- clear any previous output ---
18
+ if OUTPUT_GIF.exists():
19
+ OUTPUT_GIF.unlink() # delete old GIF
20
+ if PALETTE_PNG.exists():
21
+ PALETTE_PNG.unlink() # delete old palette
22
+ # optional: clear any old frame PNGs
23
+ for f in TARGET_DIR.glob("img*.png"):
24
+ f.unlink()
25
+
26
  # 1) Run inference to generate frames into TARGET_DIR/img%d.png
27
  subprocess.run([
28
  "python3", "inference_img.py",