from google.colab import drive
drive.mount('/content/gdrive')
from tqdm import tqdm
import requests
import os

# you can put the rest on a second cell 

url = "https://civitai.com/api/download/models/4048"  #@param {type:"string"}
destPath = "/content/gdrive/My Drive/models/Protogen3.ckpt"  #@param {type:"string"}
with requests.get(url, stream=True) as r:
    length = int(r.headers['Content-Length'])
    print("Total:",length)
    r.raise_for_status()
    with open(destPath, 'wb') as f:
        pbar = tqdm(total=length)
        for chunk in r.iter_content(chunk_size=8192):
            if chunk: 
                f.write(chunk)
                pbar.update(len(chunk))

file_size = os.path.getsize(destPath)
if file_size == length:
    print("\nDone")
else:
    raise RuntimeError("File size mismatch: got {} of {}".format(file_size, length))