INNER CODE UNIT · Python

get_data

NirantK/NLP_Quickbook · Part-08 Web Deployments/utils.py:18

def get_data(url, filename):
    """
    Download data if the filename does not exist already
    Uses Tqdm to show download progress
    """
    if not os.path.exists(filename):

        dirname = os.path.dirname(filename)
        if not os.path.exists(dirname):
            os.makedirs(dirname)

        with TqdmUpTo(
            unit="B", unit_scale=True, miniters=1, desc=url.split("/")[-1]
        ) as t:
            urlretrieve(url, filename, reporthook=t.update_to)


def read_data(dir_path):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…