code: def download_with_progress(
      url: str, path: str = None
  ) -> Generator[str, int, int]:
      """
      Download a file and return the downloading progress -> Generator[filename, download_size, total_size]
      Args:
          url (str) : url to be downloaded
          path (str, optional) : path to store downloaded products, default is current work directory
      Examples:
          .. code-block:: python
              url = 'https://xxxxx.xx/xx.tar.gz'
              for filename, download_size, total_szie in download_with_progress(url, path='./output'):
                  print(filename, download_size, total_size)
      """
      path = os.getcwd() if not path else path
      if not os.path.exists(path):
          os.makedirs(path)
  
      parse_result = urlparse(url)
      savename = parse_result.path.split("/")[-1]
      savename = os.path.join(path, savename)
  
      res = requests.get(url, stream=True)
      download_size = 0
      total_size = int(res.headers.get("content-length"))
      with open(savename, "wb") as _file:
          for data in res.iter_content(chunk_size=4096):
              _file.write(data)
              download_size += len(data)
              yield savename, download_size, total_size
  
imports: import base64
  import contextlib
  import hashlib
  import importlib
  import math
  import os
  import socket
  import sys
  import tempfile
  import time
  import traceback
  import types
  from typing import Generator
  from typing import List
  from urllib.parse import urlparse
  import cv2
  import numpy
  import packaging.version
  import requests
  import paddlehub.env
  import paddlehub.utils
  from paddlehub.utils.log import logger
label_desc: Use image node_id 7 for calling a global function with example usage: download_with_progress(url, path) without return types