From d8a14a6dc8b71444c484fa6e869e4f980d9c7534 Mon Sep 17 00:00:00 2001 From: Kappa Date: Tue, 18 Apr 2023 06:39:30 +0600 Subject: [PATCH] New version 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. --- lib/Downloader for Hugging Face.bat | 5 ++++- lib/download-model.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/Downloader for Hugging Face.bat b/lib/Downloader for Hugging Face.bat index 7c07703..57b6c38 100644 --- a/lib/Downloader for Hugging Face.bat +++ b/lib/Downloader for Hugging Face.bat @@ -1,4 +1,7 @@ @echo off call venv\Scripts\activate.bat -python.exe download-model.py %* \ No newline at end of file +pip install pywin32 +pip install beautifulsoup4 +python.exe download-model.py %* +pause \ No newline at end of file diff --git a/lib/download-model.py b/lib/download-model.py index 0957820..aa06be7 100644 --- a/lib/download-model.py +++ b/lib/download-model.py @@ -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) @@ -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 @@ -105,4 +112,4 @@ def main(): print(f"Error occurred while downloading a file: {e}") if __name__ == "__main__": - main() + main() \ No newline at end of file