anchor commited on
Commit
95cfaf5
1 Parent(s): b8f993c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -1
app.py CHANGED
@@ -9,6 +9,7 @@ import sys
9
  import subprocess
10
 
11
  from huggingface_hub import snapshot_download
 
12
 
13
  import argparse
14
  import os
@@ -27,11 +28,12 @@ from musetalk.utils.preprocessing import get_landmark_and_bbox,read_imgs,coord_p
27
  from musetalk.utils.blending import get_image
28
  from musetalk.utils.utils import load_all_model
29
  import shutil
 
30
 
31
 
32
 
33
  ProjectDir = os.path.abspath(os.path.dirname(__file__))
34
- CheckpointsDir = os.path.join(ProjectDir, "models")
35
 
36
  def download_model():
37
  if not os.path.exists(CheckpointsDir):
@@ -44,7 +46,54 @@ def download_model():
44
  max_workers=8,
45
  local_dir_use_symlinks=True,
46
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  toc = time.time()
 
48
  print(f"download cost {toc-tic} seconds")
49
  else:
50
  print("Already download the model.")
 
9
  import subprocess
10
 
11
  from huggingface_hub import snapshot_download
12
+ import requests
13
 
14
  import argparse
15
  import os
 
28
  from musetalk.utils.blending import get_image
29
  from musetalk.utils.utils import load_all_model
30
  import shutil
31
+ import gdown
32
 
33
 
34
 
35
  ProjectDir = os.path.abspath(os.path.dirname(__file__))
36
+ CheckpointsDir = os.path.join(ProjectDir, "checkpoints")
37
 
38
  def download_model():
39
  if not os.path.exists(CheckpointsDir):
 
46
  max_workers=8,
47
  local_dir_use_symlinks=True,
48
  )
49
+ # weight
50
+ snapshot_download(
51
+ repo_id="stabilityai/sd-vae-ft-mse",
52
+ local_dir=CheckpointsDir,
53
+ max_workers=8,
54
+ local_dir_use_symlinks=True,
55
+ )
56
+ #dwpose
57
+ snapshot_download(
58
+ repo_id="yzd-v/DWPose",
59
+ local_dir=CheckpointsDir,
60
+ max_workers=8,
61
+ local_dir_use_symlinks=True,
62
+ )
63
+ #vae
64
+ url = "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt"
65
+ response = requests.get(url)
66
+ # 确保请求成功
67
+ if response.status_code == 200:
68
+ # 指定文件保存的位置
69
+ file_path = f"{CheckpointsDir}/whisper/tiny.pt"
70
+ os.makedirs(f"{CheckpointsDir}/whisper/")
71
+ # 将文件内容写入指定位置
72
+ with open(file_path, "wb") as f:
73
+ f.write(response.content)
74
+ else:
75
+ print(f"请求失败,状态码:{response.status_code}")
76
+ #gdown face parse
77
+ url = "https://drive.google.com/uc?id=154JgKpzCPW82qINcVieuPH3fZ2e0P812"
78
+ os.makedirs(f"{CheckpointsDir}/face-parse-bisent/")
79
+ file_path = f"{CheckpointsDir}/face-parse-bisent/79999_iter.pth"
80
+ gdown.download(url, output, quiet=False)
81
+ #resnet
82
+ url = "https://download.pytorch.org/models/resnet18-5c106cde.pth"
83
+ response = requests.get(url)
84
+ # 确保请求成功
85
+ if response.status_code == 200:
86
+ # 指定文件保存的位置
87
+ file_path = f"{CheckpointsDir}/face-parse-bisent/resnet18-5c106cde.pth"
88
+ # 将文件内容写入指定位置
89
+ with open(file_path, "wb") as f:
90
+ f.write(response.content)
91
+ else:
92
+ print(f"请求失败,状态码:{response.status_code}")
93
+
94
+
95
  toc = time.time()
96
+
97
  print(f"download cost {toc-tic} seconds")
98
  else:
99
  print("Already download the model.")