Spaces:
Running
Running
clear output
Browse files
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",
|