Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
The script has been updated, now you can download all the files at once.
The startup file has also been updated, a preinstallable library has been added.
  • Loading branch information
sashaok123 authored Apr 18, 2023
1 parent c909b71 commit d8a14a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/Downloader for Hugging Face.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@echo off

call venv\Scripts\activate.bat
python.exe download-model.py %*
pip install pywin32
pip install beautifulsoup4
python.exe download-model.py %*
pause
11 changes: 9 additions & 2 deletions lib/download-model.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def get_download_links(url):
return download_links

clear_console()

def main():
current_dir = os.path.abspath(os.getcwd())
create_shortcut(current_dir)
Expand All @@ -89,7 +90,13 @@ def main():
file_base, file_ext = os.path.splitext(file_name)
print(f"{i}: {file_base}{file_ext}")

selected_files = input("\nEnter the numbers of the files you want to download (separated by spaces): ").split(' ')
# Добавляем опцию выбора "скачать все файлы"
selected_files = input("\nEnter the numbers of the files you want to download (separated by spaces) or type 'all' to download all files: ").strip().lower()

if selected_files == 'all':
selected_files = [str(i) for i in range(1, len(unique_download_links) + 1)]
else:
selected_files = selected_files.split(' ')

parent_folder = Path(os.path.abspath(os.path.join(os.getcwd(), os.pardir)))
output_folder = parent_folder / "Downloaded models" / model_name
Expand All @@ -105,4 +112,4 @@ def main():
print(f"Error occurred while downloading a file: {e}")

if __name__ == "__main__":
main()
main()

0 comments on commit d8a14a6

Please sign in to comment.