diff --git a/.github/workflows/generate-webpage.yml b/.github/workflows/generate-webpage.yml index 1c11c30..a81b6a6 100644 --- a/.github/workflows/generate-webpage.yml +++ b/.github/workflows/generate-webpage.yml @@ -51,17 +51,13 @@ jobs: file.close() return (size, None) - - # Get list of model directories - # working_dir = os.getcwd() - # root_dir_list = [] - # for x in os.listdir(working_dir): - # if os.path.isdir(x): - # root_dir_list.append(x) - # Get list of models under the sd-concepts-library organization api = HfApi() - root_dir_list = api.list_models(author="sd-concepts-library").sort() + models_list = [] + for model in api.list_models(author="sd-concepts-library"): + models_list.append(model.modelId.replace('sd-concepts-library/', '')) + models_list.sort() + print(models_list) html_struct = """ @@ -111,8 +107,8 @@ jobs: # Move the model out i = 1 - for model_name in root_dir_list: - print(f'{i}/{len(root_dir_list)} -> {model_name}') + for model_name in models_list: + print(f'{i}/{len(models_list)} -> {model_name}') # if os.path.exists(f'{model_name}/learned_embeds.bin'): # double check the file exists since sometimes it hasn't been uploaded yet # shutil.move(f'{model_name}/learned_embeds.bin', f'{model_name}/{model_name}.pt') # pass diff --git a/other/generate_tx_models_html.py b/other/generate_tx_models_html.py index 3fa4752..cf6891e 100644 --- a/other/generate_tx_models_html.py +++ b/other/generate_tx_models_html.py @@ -26,17 +26,13 @@ def getsizes(uri): file.close() return (size, None) - -# Get list of model directories -# working_dir = os.getcwd() -# root_dir_list = [] -# for x in os.listdir(working_dir): -# if os.path.isdir(x): -# root_dir_list.append(x) - # Get list of models under the sd-concepts-library organization api = HfApi() -root_dir_list = api.list_models(author="sd-concepts-library").sort() +models_list = [] +for model in api.list_models(author="sd-concepts-library"): + models_list.append(model.modelId.replace('sd-concepts-library/', '')) +models_list.sort() +print(models_list) html_struct = """ @@ -86,8 +82,8 @@ html_struct = """ # Move the model out i = 1 -for model_name in root_dir_list: - print(f'{i}/{len(root_dir_list)} -> {model_name}') +for model_name in models_list: + print(f'{i}/{len(models_list)} -> {model_name}') # if os.path.exists(f'{model_name}/learned_embeds.bin'): # double check the file exists since sometimes it hasn't been uploaded yet # shutil.move(f'{model_name}/learned_embeds.bin', f'{model_name}/{model_name}.pt') # pass