Xuanyou commited on
Commit
6e96b2c
·
verified ·
1 Parent(s): f7b66af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -32,24 +32,20 @@ def download_liveportrait():
32
  print("Cloning LivePortrait repository...")
33
  os.system(f"git clone https://github.com/KwaiVGI/LivePortrait.git {liveportrait_path}")
34
 
35
- # 安装依赖
36
  os.chdir(liveportrait_path)
37
  print("Installing LivePortrait dependencies...")
38
  os.system("pip install -r requirements.txt")
39
-
40
- # 构建 MultiScaleDeformableAttention 模块
41
  dependency_path = "src/utils/dependencies/XPose/models/UniPose/ops"
42
  os.chdir(dependency_path)
43
  print("Building MultiScaleDeformableAttention...")
44
  os.system("python setup.py build")
45
  os.system("python setup.py install")
46
 
47
- # 确保模块路径可用
48
  module_path = os.path.abspath(dependency_path)
49
  if module_path not in sys.path:
50
  sys.path.append(module_path)
51
 
52
- # 返回 LivePortrait 目录
53
  os.chdir("../../../../../../../")
54
  print("LivePortrait setup completed")
55
  except Exception as e:
@@ -167,7 +163,7 @@ def crop_face_to_square(image_rgb, padding_ratio=0.2, height_multiplier=1.5):
167
 
168
  cropped_image = image_rgb[top_left_y:bottom_right_y, top_left_x:bottom_right_x]
169
 
170
- resized_image = cv2.resize(cropped_image, (768, int(768 * height_multiplier)), interpolation=cv2.INTER_AREA)
171
 
172
  return resized_image
173
 
 
32
  print("Cloning LivePortrait repository...")
33
  os.system(f"git clone https://github.com/KwaiVGI/LivePortrait.git {liveportrait_path}")
34
 
 
35
  os.chdir(liveportrait_path)
36
  print("Installing LivePortrait dependencies...")
37
  os.system("pip install -r requirements.txt")
38
+
 
39
  dependency_path = "src/utils/dependencies/XPose/models/UniPose/ops"
40
  os.chdir(dependency_path)
41
  print("Building MultiScaleDeformableAttention...")
42
  os.system("python setup.py build")
43
  os.system("python setup.py install")
44
 
 
45
  module_path = os.path.abspath(dependency_path)
46
  if module_path not in sys.path:
47
  sys.path.append(module_path)
48
 
 
49
  os.chdir("../../../../../../../")
50
  print("LivePortrait setup completed")
51
  except Exception as e:
 
163
 
164
  cropped_image = image_rgb[top_left_y:bottom_right_y, top_left_x:bottom_right_x]
165
 
166
+ # resized_image = cv2.resize(cropped_image, (768, int(768 * height_multiplier)), interpolation=cv2.INTER_AREA)
167
 
168
  return resized_image
169