(
    models_root_dir='/tmp/sketch_rnn/models',
    pretrained_models_url=PRETRAINED_MODELS_URL)
Download pretrained models to a temporary directory.
Download pretrained models to a temporary directory.
Download pretrained models to a temporary directory .
def download_pretrained_models(
    models_root_dir='/tmp/sketch_rnn/models',
    pretrained_models_url=PRETRAINED_MODELS_URL):
  """Download pretrained models to a temporary directory."""
  tf.gfile.MakeDirs(models_root_dir)
  zip_path = os.path.join(
      models_root_dir, os.path.basename(pretrained_models_url))
  if os.path.isfile(zip_path):
    tf.logging.info('%s already exists, using cached copy', zip_path)
  else:
    tf.logging.info('Downloading pretrained models from %s...',
                    pretrained_models_url)
    urlretrieve(pretrained_models_url, zip_path)
    tf.logging.info('Download complete.')
  tf.logging.info('Unzipping %s...', zip_path)
  with zipfile.ZipFile(zip_path) as models_zip:
    models_zip.extractall(models_root_dir)
  tf.logging.info('Unzipping complete.')
def download_pretrained_models ( models_root_dir = '/tmp/sketch_rnn/models' , pretrained_models_url = PRETRAINED_MODELS_URL ) : tf . gfile . MakeDirs ( models_root_dir ) zip_path = os . path . join ( models_root_dir , os . path . basename ( pretrained_models_url ) ) if os . path . isfile ( zip_path ) : tf . logging . info ( '%s already exists, using cached copy' , zip_path ) else : tf . logging . info ( 'Downloading pretrained models from %s...' , pretrained_models_url ) urlretrieve ( pretrained_models_url , zip_path ) tf . logging . info ( 'Download complete.' ) tf . logging . info ( 'Unzipping %s...' , zip_path ) with zipfile . ZipFile ( zip_path ) as models_zip : models_zip . extractall ( models_root_dir ) tf . logging . info ( 'Unzipping complete.' )