diff --git a/.github/workflows/test_links.yml b/.github/workflows/test_links.yml new file mode 100644 index 0000000..9404022 --- /dev/null +++ b/.github/workflows/test_links.yml @@ -0,0 +1,68 @@ +name: Check Links + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check-links: + runs-on: ubuntu-latest + + steps: + - name: Проверка кода + uses: actions/checkout@v4 + + - name: Настройка Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Установка зависимостей + run: | + pip install --upgrade pip==23.1 + pip install requests gdown gradio + + - name: Google Drive + run: | + python rvc/modules/model_management.py "https://drive.google.com/file/d/1lVQuCq5sQXRnAb_Z6m0nKb9305aePowy/view?usp=sharing" "test_model" + + - name: HuggingFace + run: | + python rvc/modules/model_management.py "https://huggingface.co/Politrees/Victor_Tsoi/resolve/main/Victor_Tsoi.zip?download=true" "test_model" + + +# - name: Pixeldrain +# run: | +# python rvc/modules/model_management.py "" "test_model" + +# - name: Mega +# run: | +# python rvc/modules/model_management.py "" "test_model" + +# - name: Яндекс Диск +# run: | +# python rvc/modules/model_management.py "" "test_model" + +# - name: OneDrive +# run: | +# python rvc/modules/model_management.py "" "test_model" + + - name: Dropbox + run: | + python rvc/modules/model_management.py "https://www.dropbox.com/scl/fi/qgwb61xk365uoaled6s7b/Model.zip?rlkey=lljqcjqn8appak3jns5b6rc1r&st=tgyolk2w&dl=0" "test_model" + + - name: Box + run: | + python rvc/modules/model_management.py "https://app.box.com/s/gh08lk2wtmy893hz1n06uhl8jr7n29sg" "test_model" + + - name: MediaFire + run: | + python rvc/modules/model_management.py "https://www.mediafire.com/file/0cjw4ho9m2ap7z0/Model.zip/file" "test_model" + + - name: pCloud + run: | + python rvc/modules/model_management.py "https://e.pcloud.link/publink/show?code=XZTUsPZmjRlLDvPbAfEP7t4fvSHPYID49PV" "test_model" \ No newline at end of file diff --git a/rvc/modules/model_management.py b/rvc/modules/model_management.py index cfee4a3..937f540 100644 --- a/rvc/modules/model_management.py +++ b/rvc/modules/model_management.py @@ -1,5 +1,6 @@ import os import re +import sys import shutil import urllib.request import zipfile @@ -210,3 +211,23 @@ def upload_separate_files(pth_file, index_file, dir_name, progress=gr.Progress() return f"[+] Модель {dir_name} успешно загружена!" except Exception as e: raise gr.Error(str(e)) + + +# Функция для вызова из командной строки +def main(): + if len(sys.argv) != 3: + print("Использование: python model_management.py ") + sys.exit(1) + + url = sys.argv[1] + dir_name = sys.argv[2] + + try: + result = download_from_url(url, dir_name) + print(result) + except gr.Error as e: + print(f"Error: {str(e)}") + sys.exit(1) + +if __name__ == "__main__": + main() \ No newline at end of file