Merge pull request #13 from UnderSampled/blip-download

Directly download BLIP model to file
This commit is contained in:
Victor Hall 2022-11-25 14:06:38 -08:00 committed by GitHub
commit 759228bf88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -109,9 +109,9 @@ async def main(opt):
async with aiohttp.ClientSession() as session:
async with session.get(BLIP_MODEL_URL) as res:
result = await res.read()
with open(model_cache_path, 'wb') as f:
f.write(result)
async for chunk in res.content.iter_chunked(1024):
f.write(chunk)
print(f"Model cached to: {model_cache_path}")
else:
print(f"Model already cached to: {model_cache_path}")