Colab cannot show image from the fastbook

Hi all, I am pretty new to google colab and just started learning the 2020 Part 1 course. I was trying to open the fastbook from my google drive as a colab jupyter notebook format. However, the image in the markdown was not properly displayed. It looks fine when I was running Jupyter notebook on my local laptop. The code to render the picture in the fastbook is shown as below as well as the broken image that showed in the colab. Could someone shine some light on?

`<img alt="An example of notebook" width="700" caption="A Jupyter notebook" src="images/0_jupyter.png" id="jupyter"/>`

image

Things I have tried based on my research online but with no luck:

  1. make sure my google drive is mounted

    from google.colab import drive drive.mount(’/content/drive’)

  2. Try to Cd to my current directory and verified by !pwd

    %cd ./drive/MyDrive/xxx/xxx-master/

Thanks.

Hi flyforward2011 hope you are having a marvelous day!

It’s been a while since I have played with this notebook but on colab.
I use the code below which is from the PIL image library (may of had the same issue as you)

dest = '/content/gdrive/MyDrive/artists/oto_dix/a_220.jpg'
im = Image.open(dest)
im.to_thumb(128,128)

I create a directory on my gdrive so the files are there permanently.

On notebooks on my mac I am using the following methods also.

The mk1 perceptron. ![](images/mk1_perceptron.png)

image

<img src="images/dali.jpg">

Not sure why the particular code is not working on colab, you could try including the path name in the html code to see if that works.

I tried your code on my notebook and it worked fine.

I tried your code on google colab and it failed.

If you use the menu in the text element on colab to insert the image, you will see it uses a different format for displaying images.

Hope :smiley: this helps you move forward, there’s enough for us to learn in ai without us getting bogged down on things that should be straightforward.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

Hi mrfabulous1,

Thank you very much for your help. I have tried to put the full path there but with no luck. I just wanted to have everything in one place, reading the fastai book and practicing the code. It seems like I need to do them separately on colab and local jupyter notebook :grinning: