INNER CODE UNIT · Python

download_file

visomaster/VisoMaster · app/helpers/downloader.py:9

def download_file(model_name: str, file_path: str, correct_hash: str, url: str) -> bool:
    """
    Downloads a file and verifies its integrity.

    Parameters:
    - model_name (str): Name of the model being downloaded.
    - file_path (str): Path where the file will be saved.
    - correct_hash (str): Expected hash value of the file for integrity check.
    - url (str): URL to download the file from.

    Returns:
    - bool: True if the file is downloaded and verified successfully, False otherwise.
    """
    # Remove the file if it already exists and restart download
    if Path(file_path).is_file():
        if check_file_integrity(file_path, correct_hash):
            print(f"\nSkipping {model_name} as it is already downloaded!")
            return True

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…