Warm tip: This article is reproduced from serverfault.com, please click

Is there a way to download data from a public link to google colab?

发布于 2020-12-01 22:52:40

I am currently working with a Jupyter file on google colab with 5000 images and several csv files. I wish to find a way to download these data into the colab from a shareable link from google drive without mount to drive, which is: I upload these data into drive first and make them "anyone can view with link", and then I wish to find a way to download these data into colab with this link (So that others can simply run my code without authorization or mount to drive)

Is there any way I can achieve this? Thank you!

Questioner
Michael Zhang
Viewed
0
korakot 2020-12-02 21:15:56

You can use gdown.

For example, an image url

https://drive.google.com/file/d/1ztBz3C_2BlXgNGK2mbarGnVqoI287_XT/view?usp=sharing

It's id = 1ztBz3C_2BlXgNGK2mbarGnVqoI287_XT

So, you can download it with

!gdown --id 1ztBz3C_2BlXgNGK2mbarGnVqoI287_XT