Fix
Browse files- app_upload.py +3 -1
- trainer.py +2 -1
- uploader.py +5 -2
app_upload.py
CHANGED
@@ -21,6 +21,7 @@ class ModelUploader(Uploader):
|
|
21 |
private: bool,
|
22 |
delete_existing_repo: bool,
|
23 |
input_hf_token: str | None = None,
|
|
|
24 |
) -> str:
|
25 |
if not folder_path:
|
26 |
raise ValueError
|
@@ -40,7 +41,8 @@ class ModelUploader(Uploader):
|
|
40 |
organization=organization,
|
41 |
private=private,
|
42 |
delete_existing_repo=delete_existing_repo,
|
43 |
-
input_hf_token=input_hf_token
|
|
|
44 |
|
45 |
|
46 |
def load_local_model_list() -> dict:
|
|
|
21 |
private: bool,
|
22 |
delete_existing_repo: bool,
|
23 |
input_hf_token: str | None = None,
|
24 |
+
return_html_link: bool = True,
|
25 |
) -> str:
|
26 |
if not folder_path:
|
27 |
raise ValueError
|
|
|
41 |
organization=organization,
|
42 |
private=private,
|
43 |
delete_existing_repo=delete_existing_repo,
|
44 |
+
input_hf_token=input_hf_token,
|
45 |
+
return_html_link=return_html_link)
|
46 |
|
47 |
|
48 |
def load_local_model_list() -> dict:
|
trainer.py
CHANGED
@@ -152,7 +152,8 @@ class Trainer:
|
|
152 |
upload_to=upload_to,
|
153 |
private=use_private_repo,
|
154 |
delete_existing_repo=delete_existing_repo,
|
155 |
-
input_hf_token=input_hf_token
|
|
|
156 |
with open(self.log_file, 'a') as f:
|
157 |
f.write(upload_message)
|
158 |
|
|
|
152 |
upload_to=upload_to,
|
153 |
private=use_private_repo,
|
154 |
delete_existing_repo=delete_existing_repo,
|
155 |
+
input_hf_token=input_hf_token,
|
156 |
+
return_html_link=False)
|
157 |
with open(self.log_file, 'a') as f:
|
158 |
f.write(upload_message)
|
159 |
|
uploader.py
CHANGED
@@ -14,7 +14,8 @@ class Uploader:
|
|
14 |
repo_type: str = 'model',
|
15 |
private: bool = True,
|
16 |
delete_existing_repo: bool = False,
|
17 |
-
input_hf_token: str | None = None
|
|
|
18 |
|
19 |
api = HfApi(token=self.hf_token or input_hf_token)
|
20 |
|
@@ -38,7 +39,9 @@ class Uploader:
|
|
38 |
path_in_repo='.',
|
39 |
repo_type=repo_type)
|
40 |
url = f'https://huggingface.co/{repo_id}'
|
41 |
-
|
|
|
|
|
42 |
except Exception as e:
|
43 |
message = str(e)
|
44 |
return message
|
|
|
14 |
repo_type: str = 'model',
|
15 |
private: bool = True,
|
16 |
delete_existing_repo: bool = False,
|
17 |
+
input_hf_token: str | None = None,
|
18 |
+
return_html_link: bool = True) -> str:
|
19 |
|
20 |
api = HfApi(token=self.hf_token or input_hf_token)
|
21 |
|
|
|
39 |
path_in_repo='.',
|
40 |
repo_type=repo_type)
|
41 |
url = f'https://huggingface.co/{repo_id}'
|
42 |
+
if return_html_link:
|
43 |
+
url = f'<a href="{url}" target="_blank">{url}</a>'
|
44 |
+
message = f'Your model was successfully uploaded to {url}.'
|
45 |
except Exception as e:
|
46 |
message = str(e)
|
47 |
return message
|