Update build_logic.py
Browse files- build_logic.py +9 -1
build_logic.py
CHANGED
@@ -16,7 +16,7 @@ from huggingface_hub import (
|
|
16 |
HfApi,
|
17 |
#list_repos as hf_list_repos,
|
18 |
create_pull_request as hf_create_pull_request,
|
19 |
-
add_space_comment as hf_add_space_comment, # Public API for adding comments to Space discussions
|
20 |
like as hf_like # Public API for liking repos
|
21 |
)
|
22 |
from huggingface_hub.hf_api import CommitOperationDelete, CommitOperationAdd, CommitOperation
|
@@ -28,6 +28,14 @@ logging.basicConfig(
|
|
28 |
)
|
29 |
logger = logging.getLogger(__name__)
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
def _get_api_token(ui_token_from_textbox=None):
|
32 |
env_token = os.getenv('HF_TOKEN')
|
33 |
if ui_token_from_textbox:
|
|
|
16 |
HfApi,
|
17 |
#list_repos as hf_list_repos,
|
18 |
create_pull_request as hf_create_pull_request,
|
19 |
+
#add_space_comment as hf_add_space_comment, # Public API for adding comments to Space discussions
|
20 |
like as hf_like # Public API for liking repos
|
21 |
)
|
22 |
from huggingface_hub.hf_api import CommitOperationDelete, CommitOperationAdd, CommitOperation
|
|
|
28 |
)
|
29 |
logger = logging.getLogger(__name__)
|
30 |
|
31 |
+
def hf_add_space_comment(owner_repo,token,discussion,comment):
|
32 |
+
result = HfApi(token=token).comment_discussion(
|
33 |
+
repo_id=owner_repo,
|
34 |
+
discussion_num=discussion,
|
35 |
+
comment=comment
|
36 |
+
)
|
37 |
+
return result
|
38 |
+
|
39 |
def _get_api_token(ui_token_from_textbox=None):
|
40 |
env_token = os.getenv('HF_TOKEN')
|
41 |
if ui_token_from_textbox:
|