AItool commited on
Commit
463c565
·
verified ·
1 Parent(s): 6b58d86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -13,9 +13,9 @@ FRAME2 = Path("demo/frame2.jpg")
13
  DEMO = Path("demo/demo.gif")
14
  MODEL = Path("train_log/")
15
 
16
- TMP_PREFIX = "/tmp/gradio/"
17
  TARGET_DIR = f"{TMP_PREFIX}output/"
18
- EXTENSION = "gif"
19
 
20
  def interpolate_image(img_a_path: str, img_b_path: str) -> Tuple[str, str]:
21
  """
@@ -37,13 +37,24 @@ def interpolate_image(img_a_path: str, img_b_path: str) -> Tuple[str, str]:
37
  #inference_img(img=[Path(img_a_path), Path(img_b_path)],exp=4)
38
 
39
  print("ok")
40
- # 1) Run interpolation (frames -> TARGET_DIR/img1.png ... imgN.png)
41
- subprocess.run([
42
- "python3", "inference_img.py",
43
- "--img", str(img_a_path), str(img_b_path),
44
- "--exp", "4"
 
45
  ], check=True)
46
 
 
 
 
 
 
 
 
 
 
 
47
  print("ok")
48
  # 2) Generate palette
49
  subprocess.run([
 
13
  DEMO = Path("demo/demo.gif")
14
  MODEL = Path("train_log/")
15
 
16
+ TMP_PREFIX = "demo/"
17
  TARGET_DIR = f"{TMP_PREFIX}output/"
18
+ EXTENSION = "png"
19
 
20
  def interpolate_image(img_a_path: str, img_b_path: str) -> Tuple[str, str]:
21
  """
 
37
  #inference_img(img=[Path(img_a_path), Path(img_b_path)],exp=4)
38
 
39
  print("ok")
40
+
41
+ subprocess.run([
42
+ "ffmpeg", "-y", "-r", "14", "-f", "image2",
43
+ "-i", f"{TARGET_DIR}img%d.png",
44
+ "-vf", "palettegen=stats_mode=single",
45
+ palette_path
46
  ], check=True)
47
 
48
+
49
+
50
+
51
+ # 1) Run interpolation (frames -> TARGET_DIR/img1.png ... imgN.png)
52
+ #subprocess.run([
53
+ # "python3", "inference_img.py",
54
+ # "--img", str(img_a_path), str(img_b_path),
55
+ # "--exp", "4"
56
+ #], check=True)
57
+
58
  print("ok")
59
  # 2) Generate palette
60
  subprocess.run([