from modelscope.hub.api import HubApi

YOUR_ACCESS_TOKEN = '672c3a5a-4b18-4e97-b557-8b71c443b4f4'
api = HubApi()
api.login(YOUR_ACCESS_TOKEN)

# 1. 创建模型库
from modelscope.hub.constants import Licenses, ModelVisibility

username = 'FoolBird'
model_name = 'Qwen-2.5-1.5b-instruct-JZFH'
model_id=f"{username}/{model_name}"

api.create_model(
    model_id,
    visibility=ModelVisibility.PUBLIC,
    license=Licenses.APACHE_V2,
    chinese_name="千问2.5-1.5B-建筑防火规范",
)

# # 2. 上传模型文件

# api.push_model(
#     model_id=model_id, # 如果model_id对应的模型库不存在，将会被自动创建
#     model_dir="D:\PythonProject\output", # 指定本地模型所在目录
#     revision='new_branch'  # 更改分支名称
# )