Xiang12yu commited on
Commit
479b8c1
·
verified ·
1 Parent(s): 1147db0

Delete upload.py

Browse files
Files changed (1) hide show
  1. upload.py +0 -47
upload.py DELETED
@@ -1,47 +0,0 @@
1
- import os
2
- import sys
3
- import subprocess
4
-
5
- # ========== 配置区 ==========
6
- REPO = "HorizonRobotics/Uni3R" # 改成你的 Hugging Face 仓库
7
- REPO_DIR = "myrepo" # 克隆到本地的文件夹名
8
- # ===========================
9
-
10
- def run(cmd):
11
- """运行 shell 命令,失败则抛异常"""
12
- print(f"➡️ 运行: {' '.join(cmd)}")
13
- result = subprocess.run(cmd)
14
- if result.returncode != 0:
15
- raise RuntimeError(f"命令失败: {' '.join(cmd)}")
16
-
17
- def main():
18
- if len(sys.argv) < 2:
19
- print("❌ 用法: python upload.py /path/to/local/file [提交说明]")
20
- sys.exit(1)
21
-
22
- file_path = sys.argv[1]
23
- if not os.path.exists(file_path):
24
- print(f"❌ 文件不存在: {file_path}")
25
- sys.exit(1)
26
-
27
- commit_msg = sys.argv[2] if len(sys.argv) > 2 else "update"
28
-
29
- # 克隆仓库(如果不存在)
30
- if not os.path.exists(REPO_DIR):
31
- run(["git", "clone", f"https://huggingface.co/{REPO}", REPO_DIR])
32
-
33
- os.chdir(REPO_DIR)
34
-
35
- # 拷贝文件
36
- run(["cp", file_path, "."])
37
-
38
- # 提交并推送
39
- run(["git", "add", "."])
40
- run(["git", "commit", "-m", commit_msg])
41
- run(["git", "push"])
42
-
43
- print("✅ 上传成功!")
44
-
45
- if __name__ == "__main__":
46
- main()
47
-