vumichien commited on
Commit
a69ad45
1 Parent(s): 23a56cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -17,14 +17,15 @@ os.system('pip install numpy==1.23.3')
17
  os.chdir('/home/user/app/av_hubert/avhubert')
18
 
19
  sys.path.append('/home/user/app/av_hubert')
 
20
 
21
  print(sys.path)
22
  print(os.listdir())
23
 
24
  from fairseq import checkpoint_utils, options, tasks, utils
25
  from argparse import Namespace
26
- user_dir = "/home/user/app/av_hubert/avhubert"
27
- utils.import_user_module(Namespace(user_dir=user_dir))
28
 
29
 
30
  import dlib, cv2, os
@@ -44,11 +45,13 @@ from fairseq.dataclass.configs import GenerationConfig
44
  from huggingface_hub import hf_hub_download
45
  import gradio as gr
46
 
 
47
  ckpt_path = hf_hub_download('vumichien/AV-HuBERT', 'model.pt')
48
  face_detector_path = "/home/user/app/mmod_human_face_detector.dat"
49
  face_predictor_path = "/home/user/app/shape_predictor_68_face_landmarks.dat"
50
  mean_face_path = "/home/user/app/20words_mean_face.npy"
51
  mouth_roi_path = "/home/user/app/roi.mp4"
 
52
 
53
  def detect_landmark(image, detector, predictor):
54
  gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
@@ -96,7 +99,6 @@ def predict(process_video):
96
  fo.write("".join(tsv_cont))
97
  with open(f"{data_dir}/test.wrd", "w") as fo:
98
  fo.write("".join(label_cont))
99
-
100
  modalities = ["video"]
101
  gen_subset = "test"
102
  gen_cfg = GenerationConfig(beam=20)
 
17
  os.chdir('/home/user/app/av_hubert/avhubert')
18
 
19
  sys.path.append('/home/user/app/av_hubert')
20
+ sys.path.append('/home/user/app/av_hubert/avhubert')
21
 
22
  print(sys.path)
23
  print(os.listdir())
24
 
25
  from fairseq import checkpoint_utils, options, tasks, utils
26
  from argparse import Namespace
27
+
28
+
29
 
30
 
31
  import dlib, cv2, os
 
45
  from huggingface_hub import hf_hub_download
46
  import gradio as gr
47
 
48
+ user_dir = "/home/user/app/av_hubert/avhubert"
49
  ckpt_path = hf_hub_download('vumichien/AV-HuBERT', 'model.pt')
50
  face_detector_path = "/home/user/app/mmod_human_face_detector.dat"
51
  face_predictor_path = "/home/user/app/shape_predictor_68_face_landmarks.dat"
52
  mean_face_path = "/home/user/app/20words_mean_face.npy"
53
  mouth_roi_path = "/home/user/app/roi.mp4"
54
+ utils.import_user_module(Namespace(user_dir=user_dir))
55
 
56
  def detect_landmark(image, detector, predictor):
57
  gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
 
99
  fo.write("".join(tsv_cont))
100
  with open(f"{data_dir}/test.wrd", "w") as fo:
101
  fo.write("".join(label_cont))
 
102
  modalities = ["video"]
103
  gen_subset = "test"
104
  gen_cfg = GenerationConfig(beam=20)