Spaces:
Sleeping
Sleeping
fix: use default values
Browse files
app.py
CHANGED
@@ -5,15 +5,19 @@ import os
|
|
5 |
hf_api = HfApi()
|
6 |
CURRENT_MODEL_PATH = "./current_model"
|
7 |
|
|
|
|
|
|
|
|
|
8 |
def func(hf_token, repo, revision, target_repo):
|
9 |
print('download the desired model locally ...')
|
10 |
hf_api.snapshot_download(
|
11 |
-
repo_id=repo,
|
12 |
-
revision=revision,
|
13 |
-
token=hf_token,
|
14 |
local_dir=CURRENT_MODEL_PATH,
|
15 |
)
|
16 |
-
os.listdir(CURRENT_MODEL_PATH)
|
17 |
|
18 |
return f"Using {hf_token}, the content of {repo}/{revision} has been copied to {target_repo}!"
|
19 |
|
|
|
5 |
hf_api = HfApi()
|
6 |
CURRENT_MODEL_PATH = "./current_model"
|
7 |
|
8 |
+
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
9 |
+
REPO = os.getenv("REPO")
|
10 |
+
REVISION = os.getenv("REVISION")
|
11 |
+
|
12 |
def func(hf_token, repo, revision, target_repo):
|
13 |
print('download the desired model locally ...')
|
14 |
hf_api.snapshot_download(
|
15 |
+
repo_id=repo if len(repo)>0 else REPO,
|
16 |
+
revision=revision if len(revision)>0 else REVISION,
|
17 |
+
token=hf_token if len(hf_token)>0 else HF_TOKEN,
|
18 |
local_dir=CURRENT_MODEL_PATH,
|
19 |
)
|
20 |
+
print(os.listdir(CURRENT_MODEL_PATH))
|
21 |
|
22 |
return f"Using {hf_token}, the content of {repo}/{revision} has been copied to {target_repo}!"
|
23 |
|