Muhammadidrees commited on
Commit
64a59c6
·
verified ·
1 Parent(s): 1f82ebc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -15,19 +15,41 @@ except Exception as e:
15
  os.environ["GRADIO_TEMP_DIR"] = "./tmp"
16
 
17
  try:
18
- # You can define minimal dummy args here for initialization
19
  class DummyArgs:
 
20
  wan_model_dir = "./models/Wan2.1-I2V-14B-720P"
21
  fantasytalking_model_path = "./models/fantasytalking_model.ckpt"
22
  wav2vec_model_dir = "./models/wav2vec2-base-960h"
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  args = DummyArgs()
25
  pipe, fantasytalking, wav2vec_processor, wav2vec = load_models(args)
26
  print("✅ Models loaded successfully.")
 
27
  except Exception as e:
28
  print(f"❌ Error loading models: {e}")
29
  pipe = fantasytalking = wav2vec_processor = wav2vec = None
30
- raise e # fail fast on startup if models can't load
 
31
 
32
  pipe,fantasytalking,wav2vec_processor,wav2vec = None,None,None,None
33
  @spaces.GPU(duration=1200)
 
15
  os.environ["GRADIO_TEMP_DIR"] = "./tmp"
16
 
17
  try:
18
+ # Define full dummy args with all attributes expected by load_models
19
  class DummyArgs:
20
+ # Core model paths
21
  wan_model_dir = "./models/Wan2.1-I2V-14B-720P"
22
  fantasytalking_model_path = "./models/fantasytalking_model.ckpt"
23
  wav2vec_model_dir = "./models/wav2vec2-base-960h"
24
 
25
+ # Required inference-related parameters
26
+ image_path = "./assets/images/woman.png"
27
+ audio_path = "./assets/audios/woman.wav"
28
+ prompt = "A woman is talking."
29
+ output_dir = "./output"
30
+ image_size = 512
31
+ audio_scale = 1.0
32
+ prompt_cfg_scale = 5.0
33
+ audio_cfg_scale = 5.0
34
+ max_num_frames = 81
35
+ inference_steps = 20
36
+ fps = 23
37
+ seed = 1111
38
+
39
+ # ✅ The missing one that caused your error:
40
+ num_persistent_param_in_dit = 7 * 10**9 # adjust if needed
41
+
42
+ # Preload models
43
+ print("🔄 Loading models into memory...")
44
  args = DummyArgs()
45
  pipe, fantasytalking, wav2vec_processor, wav2vec = load_models(args)
46
  print("✅ Models loaded successfully.")
47
+
48
  except Exception as e:
49
  print(f"❌ Error loading models: {e}")
50
  pipe = fantasytalking = wav2vec_processor = wav2vec = None
51
+ raise e # fail fast if model load fails
52
+
53
 
54
  pipe,fantasytalking,wav2vec_processor,wav2vec = None,None,None,None
55
  @spaces.GPU(duration=1200)