ikuner commited on
Commit
1ea50ba
1 Parent(s): de031fc

Create clone_repo.py

Browse files
Files changed (1) hide show
  1. clone_repo.py +19 -0
clone_repo.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+
4
+ # 安装 git-lfs
5
+ subprocess.run(["git", "lfs", "install"], check=True)
6
+
7
+ # 克隆仓库
8
+ repo_url = "https://huggingface.co/spaces/XzJosh/dingzhen-GPT-SoVITS"
9
+ subprocess.run(["git", "clone", repo_url], check=True)
10
+
11
+ # 如果想在没有大文件的情况下克隆,仅克隆它们的指针
12
+ # subprocess.run(["GIT_LFS_SKIP_SMUDGE=1", "git", "clone", repo_url], check=True)
13
+
14
+ # 复制内容到当前目录
15
+ repo_name = repo_url.split('/')[-1]
16
+ subprocess.run(["cp", "-r", f"./{repo_name}/.", "."], check=True)
17
+
18
+ # 删除克隆的目录
19
+ subprocess.run(["rm", "-rf", repo_name], check=True)