Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,9 @@ def check_disk():
|
|
26 |
def init_git_user(username: str, email: str):
|
27 |
|
28 |
if not username or not email:
|
29 |
-
raise gr.Error(
|
|
|
|
|
30 |
|
31 |
os.system(f"git config --global user.email {email}")
|
32 |
os.system(f"git config --global user.name {username}")
|
@@ -130,7 +132,10 @@ def pull_from_hf(cache_dir, hf_repo_id):
|
|
130 |
print("pull_from_hf start")
|
131 |
api = HfApi(token=HF_TOKEN) # Token is not persisted on the machine.
|
132 |
output = api.snapshot_download(
|
133 |
-
repo_id=hf_repo_id,
|
|
|
|
|
|
|
134 |
)
|
135 |
print(f"pull_from_hf end, output: {output}")
|
136 |
return f"Pulled from {hf_repo_id}"
|
|
|
26 |
def init_git_user(username: str, email: str):
|
27 |
|
28 |
if not username or not email:
|
29 |
+
raise gr.Error(
|
30 |
+
"Please config your git username and email in the environment variables."
|
31 |
+
)
|
32 |
|
33 |
os.system(f"git config --global user.email {email}")
|
34 |
os.system(f"git config --global user.name {username}")
|
|
|
132 |
print("pull_from_hf start")
|
133 |
api = HfApi(token=HF_TOKEN) # Token is not persisted on the machine.
|
134 |
output = api.snapshot_download(
|
135 |
+
repo_id=hf_repo_id,
|
136 |
+
repo_type="model",
|
137 |
+
local_dir=cache_dir + "/hf/" + hf_repo_id,
|
138 |
+
local_dir_use_symlinks=False,
|
139 |
)
|
140 |
print(f"pull_from_hf end, output: {output}")
|
141 |
return f"Pulled from {hf_repo_id}"
|