anchor commited on
Update app.py
Browse files8 unmodified lines9101112131412 unmodified lines27282930313233343536376 unmodified lines444546474849508 unmodified linesimport subprocessfrom huggingface_hub import snapshot_downloadimport argparseimport os12 unmodified linesfrom musetalk.utils.blending import get_imagefrom musetalk.utils.utils import load_all_modelimport shutilProjectDir = os.path.abspath(os.path.dirname(__file__))CheckpointsDir = os.path.join(ProjectDir, "models")def download_model():if not os.path.exists(CheckpointsDir):6 unmodified linesmax_workers=8,local_dir_use_symlinks=True,)toc = time.time()print(f"download cost {toc-tic} seconds")else:print("Already download the model.")8 unmodified lines910111213141512 unmodified lines2829303132333435363738396 unmodified lines4647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798998 unmodified linesimport subprocessfrom huggingface_hub import snapshot_downloadimport requestsimport argparseimport os12 unmodified linesfrom musetalk.utils.blending import get_imagefrom musetalk.utils.utils import load_all_modelimport shutilimport gdownProjectDir = os.path.abspath(os.path.dirname(__file__))CheckpointsDir = os.path.join(ProjectDir, "checkpoints")def download_model():if not os.path.exists(CheckpointsDir):6 unmodified linesmax_workers=8,local_dir_use_symlinks=True,)# weightsnapshot_download(repo_id="stabilityai/sd-vae-ft-mse",local_dir=CheckpointsDir,max_workers=8,local_dir_use_symlinks=True,)#dwposesnapshot_download(repo_id="yzd-v/DWPose",local_dir=CheckpointsDir,max_workers=8,local_dir_use_symlinks=True,)#vaeurl = "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt"response = requests.get(url)# 确保请求成功if response.status_code == 200:# 指定文件保存的位置file_path = f"{CheckpointsDir}/whisper/tiny.pt"os.makedirs(f"{CheckpointsDir}/whisper/")# 将文件内容写入指定位置with open(file_path, "wb") as f:f.write(response.content)else:print(f"请求失败,状态码:{response.status_code}")#gdown face parseurl = "https://drive.google.com/uc?id=154JgKpzCPW82qINcVieuPH3fZ2e0P812"os.makedirs(f"{CheckpointsDir}/face-parse-bisent/")file_path = f"{CheckpointsDir}/face-parse-bisent/79999_iter.pth"gdown.download(url, output, quiet=False)#resneturl = "https://download.pytorch.org/models/resnet18-5c106cde.pth"response = requests.get(url)# 确保请求成功if response.status_code == 200:# 指定文件保存的位置file_path = f"{CheckpointsDir}/face-parse-bisent/resnet18-5c106cde.pth"# 将文件内容写入指定位置with open(file_path, "wb") as f:f.write(response.content)else:print(f"请求失败,状态码:{response.status_code}")toc = time.time()print(f"download cost {toc-tic} seconds")else:print("Already download the model.")
app.py+50-1