Is there a way to make Colab give an Audio Notification when cell has finished running

后端 未结 2 2061

I am coding Neural Network models and trainings are long to run so I would like to go doing something else then go back as soon as the cell has finished running.

There

2条回答
  •  爱一瞬间的悲伤
    2021-02-05 10:52

    Google Colab is built on top of Jupyter Notebook, so this code will work:

    import IPython.display as display
    display.Audio(url="https://yoursound.com/sound.mp3", autoplay=True)
    

    A bug that I've found is that if my web browser (Chrome) window is minimized into the dock on my Mac OS computer, the sound does not play. However, it will play in other circumstances, such as when the window is open but not in the foreground.

    You can find useful audio of English words like "done" or "complete" for alerts. Use an online dictionary that has audible pronunciations (e.g. Google or Dictionary.com), search for the word you want, use your web browser's "Inspect" tool to look at the HTML source, and then search in the HTML for "mp3".

    Here are some that I like:

    https://static.sfdict.com/audio/C07/C0702600.mp3

    https://ssl.gstatic.com/dictionary/static/pronunciation/2019-10-21/audio/do/done_en_us_1.mp3

    https://ssl.gstatic.com/dictionary/static/sounds/20180430/complete--_us_1.mp3

    You can also download the audio file to your Google Colab file system with !wget URL and then play the sound from Colab by using the local filename.

提交回复
热议问题