Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,10 @@ import io
|
|
9 |
|
10 |
FRAME1_PATH = "demo/frame1.png"
|
11 |
FRAME2_PATH = "demo/frame2.png"
|
12 |
-
TARGET_DIR = "
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
|
17 |
def generate_demo_gif(exp=2, progress=gr.Progress(track_tqdm=True)):
|
@@ -38,7 +39,7 @@ def generate_demo_gif(exp=2, progress=gr.Progress(track_tqdm=True)):
|
|
38 |
print("Exists?", os.path.exists("output/img0.png")) # ⬅️ Add it here
|
39 |
|
40 |
|
41 |
-
#
|
42 |
subprocess.run([
|
43 |
"ffmpeg", "-y", "-r", "14", "-f", "image2",
|
44 |
"-i", f"{TARGET_DIR}img%d.png",
|
@@ -55,14 +56,13 @@ subprocess.run([
|
|
55 |
OUTPUT_GIF
|
56 |
], check=True)
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
print("❌ Inference failed or output missing")
|
66 |
|
67 |
# UI setup
|
68 |
with gr.Blocks() as demo_ui:
|
|
|
9 |
|
10 |
FRAME1_PATH = "demo/frame1.png"
|
11 |
FRAME2_PATH = "demo/frame2.png"
|
12 |
+
TARGET_DIR = "output/"
|
13 |
+
#TARGET_DIR = "/home/user/app/output/"
|
14 |
+
OUTPUT_GIF = "output/output.gif"
|
15 |
+
PALETTE_FULL_PATH = "/demo/palette.png"
|
16 |
|
17 |
|
18 |
def generate_demo_gif(exp=2, progress=gr.Progress(track_tqdm=True)):
|
|
|
39 |
print("Exists?", os.path.exists("output/img0.png")) # ⬅️ Add it here
|
40 |
|
41 |
|
42 |
+
# Generate palette
|
43 |
subprocess.run([
|
44 |
"ffmpeg", "-y", "-r", "14", "-f", "image2",
|
45 |
"-i", f"{TARGET_DIR}img%d.png",
|
|
|
56 |
OUTPUT_GIF
|
57 |
], check=True)
|
58 |
|
59 |
+
subprocess.run([
|
60 |
+
"ffmpeg", "-y", "-r", "14", "-f", "image2",
|
61 |
+
"-i", f"{TARGET_DIR}img%d.png",
|
62 |
+
"-i", PALETTE_PNG,
|
63 |
+
"-lavfi", "paletteuse",
|
64 |
+
OUTPUT_GIF
|
65 |
+
], check=True)
|
|
|
66 |
|
67 |
# UI setup
|
68 |
with gr.Blocks() as demo_ui:
|