jiaweir commited on
Commit
c54a4cd
1 Parent(s): b601d28
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -39,7 +39,7 @@ def check_video_input(image_block: Image.Image):
39
  raise gr.Error("Please generate a video first")
40
 
41
 
42
- @spaces.GPU(duration=120)
43
  def optimize_stage_1(image_block: Image.Image, preprocess_chk: bool, seed_slider: int):
44
  if not os.path.exists('tmp_data'):
45
  os.makedirs('tmp_data')
@@ -56,14 +56,14 @@ def optimize_stage_1(image_block: Image.Image, preprocess_chk: bool, seed_slider
56
 
57
  # stage 1
58
  subprocess.run(f'export MKL_THREADING_LAYER=GNU;export MKL_SERVICE_FORCE_INTEL=1;python scripts/gen_vid.py --path tmp_data/{img_hash}_rgba.png --seed {seed_slider} --bg white', shell=True)
59
-
60
  # return [os.path.join('logs', 'tmp_rgba_model.ply')]
61
  return os.path.join('tmp_data', f'{img_hash}_rgba_generated.mp4')
62
 
63
  @spaces.GPU(duration=180)
64
  def optimize_stage_2(image_block: Image.Image, seed_slider: int):
65
  img_hash = hashlib.sha256(image_block.tobytes()).hexdigest()
66
- subprocess.run(f'python lgm/infer.py big --resume {ckpt_path} --test_path tmp_data/{img_hash}_rgba.png', shell=True)
67
  # stage 2
68
  subprocess.run(f'python main_4d.py --config {os.path.join("configs", "4d_demo.yaml")} input={os.path.join("tmp_data", f"{img_hash}_rgba.png")}', shell=True)
69
  # os.rename(os.path.join('logs', f'{img_hash}_rgba_frames'), os.path.join('logs', f'{img_hash}_{seed_slider:03d}_rgba_frames'))
 
39
  raise gr.Error("Please generate a video first")
40
 
41
 
42
+ @spaces.GPU()
43
  def optimize_stage_1(image_block: Image.Image, preprocess_chk: bool, seed_slider: int):
44
  if not os.path.exists('tmp_data'):
45
  os.makedirs('tmp_data')
 
56
 
57
  # stage 1
58
  subprocess.run(f'export MKL_THREADING_LAYER=GNU;export MKL_SERVICE_FORCE_INTEL=1;python scripts/gen_vid.py --path tmp_data/{img_hash}_rgba.png --seed {seed_slider} --bg white', shell=True)
59
+ subprocess.run(f'python lgm/infer.py big --resume {ckpt_path} --test_path tmp_data/{img_hash}_rgba.png', shell=True)
60
  # return [os.path.join('logs', 'tmp_rgba_model.ply')]
61
  return os.path.join('tmp_data', f'{img_hash}_rgba_generated.mp4')
62
 
63
  @spaces.GPU(duration=180)
64
  def optimize_stage_2(image_block: Image.Image, seed_slider: int):
65
  img_hash = hashlib.sha256(image_block.tobytes()).hexdigest()
66
+
67
  # stage 2
68
  subprocess.run(f'python main_4d.py --config {os.path.join("configs", "4d_demo.yaml")} input={os.path.join("tmp_data", f"{img_hash}_rgba.png")}', shell=True)
69
  # os.rename(os.path.join('logs', f'{img_hash}_rgba_frames'), os.path.join('logs', f'{img_hash}_{seed_slider:03d}_rgba_frames'))