How to load a picture into Google Colab for GitHub

I am writing a Google colab code + text and would like to export / save to GitHub. I struggle with pictures.

Option 1 is to use the picture load tool in the ribbon which does it but the image url gets unpredictably long which is very inconvenient for edits and writing.

I tried alternatively to load pictures to a folder nbextensions as suggested How can I open images in a Google Colaboratory notebook cell from uploaded png files?

%%html
<img src='/nbextensions/transformer-attention.jpg' />

which is an elegant way, but then when saving to GitHub, pictures which must be local disappear.

How to add pictures to the text in Google Colab in such a way that its practical for editing and it saves quickly to GitHub ?


If shorter URLs solve your problem, then you can use https://bitly.com/ to shorten your image URLs.


I'm pretty sure you can connect your Colab with your google drive, so you'll have easy access to your images

And then maybe you can use something like zappier to connect your google drive to you GitHub