7 Star 22 Fork 4

Gitee 极速下载/FastPhotoStyle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/NVIDIA/FastPhotoStyle
克隆/下载
download_models.py 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
# Download code taken from Code taken from https://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive/39225039#39225039
import requests
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
token = get_confirm_token(response)
if token:
params = { 'id' : id, 'confirm' : token }
response = session.get(URL, params = params, stream = True)
save_response_content(response, destination)
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
def save_response_content(response, destination):
CHUNK_SIZE = 32768
with open(destination, "wb") as f:
for chunk in response.iter_content(CHUNK_SIZE):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
file_id = '1ENgQm9TgabE1R99zhNf5q6meBvX6WFuq'
destination = './models.zip'
download_file_from_google_drive(file_id, destination)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mirrors/FastPhotoStyle.git
git@gitee.com:mirrors/FastPhotoStyle.git
mirrors
FastPhotoStyle
FastPhotoStyle
master

搜索帮助