Spaces:
Sleeping
Sleeping
feat: upload the new files
Browse files
app.py
CHANGED
|
@@ -24,6 +24,18 @@ def func(hf_token, repo, revision, target_repo):
|
|
| 24 |
local_dir=CURRENT_MODEL_PATH,
|
| 25 |
)
|
| 26 |
print(os.listdir(CURRENT_MODEL_PATH))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
return f"The content of {repo}/{revision} has been copied to {target_repo}!"
|
| 29 |
|
|
|
|
| 24 |
local_dir=CURRENT_MODEL_PATH,
|
| 25 |
)
|
| 26 |
print(os.listdir(CURRENT_MODEL_PATH))
|
| 27 |
+
|
| 28 |
+
for file in os.listdir(CURRENT_MODEL_PATH):
|
| 29 |
+
print(f'uploading {file}')
|
| 30 |
+
with open(f"{CURRENT_MODEL_PATH}/{file}", "rb") as fobj:
|
| 31 |
+
hf_api.upload_file(
|
| 32 |
+
path_or_fileobj=fileobj,
|
| 33 |
+
path_in_repo=f"{file}",
|
| 34 |
+
repo_id=target_repo,
|
| 35 |
+
repo_type="model",
|
| 36 |
+
token=hf_token,
|
| 37 |
+
commit_message=f"updating model files: {file}-{revision}",
|
| 38 |
+
)
|
| 39 |
|
| 40 |
return f"The content of {repo}/{revision} has been copied to {target_repo}!"
|
| 41 |
|