Update build_logic.py
Browse files- build_logic.py +9 -1
build_logic.py
CHANGED
@@ -13,7 +13,6 @@ from huggingface_hub import (
|
|
13 |
hf_hub_download,
|
14 |
delete_file as hf_delete_file,
|
15 |
HfApi,
|
16 |
-
list_repo as hf_list_repos
|
17 |
)
|
18 |
from huggingface_hub.hf_api import CommitOperationDelete, CommitOperationAdd, CommitOperation
|
19 |
from huggingface_hub.utils import HfHubHTTPError
|
@@ -24,6 +23,15 @@ logging.basicConfig(
|
|
24 |
)
|
25 |
logger = logging.getLogger(__name__)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
def _get_api_token(ui_token_from_textbox=None):
|
28 |
env_token = os.getenv('HF_TOKEN')
|
29 |
if env_token:
|
|
|
13 |
hf_hub_download,
|
14 |
delete_file as hf_delete_file,
|
15 |
HfApi,
|
|
|
16 |
)
|
17 |
from huggingface_hub.hf_api import CommitOperationDelete, CommitOperationAdd, CommitOperation
|
18 |
from huggingface_hub.utils import HfHubHTTPError
|
|
|
23 |
)
|
24 |
logger = logging.getLogger(__name__)
|
25 |
|
26 |
+
def hf_list_repos(user_name):
|
27 |
+
api=HfApi()
|
28 |
+
user_repos=[]
|
29 |
+
for space in api.list_spaces():
|
30 |
+
if space.id.startswith(user_name): # Check if modelId starts with the username
|
31 |
+
user_repos.append(space.id)
|
32 |
+
return user_repos
|
33 |
+
|
34 |
+
|
35 |
def _get_api_token(ui_token_from_textbox=None):
|
36 |
env_token = os.getenv('HF_TOKEN')
|
37 |
if env_token:
|