I was training a deep learning model on Google Colab. I had to go somewhere for an emergency work. When I came back, I realized that Colab was disconnected; Therefore, I had to run the whole model again.
I searched on the Internet to solve this problem. I noticed that Colab will be disconnected if you don't click on the page. Here is an answer that I find:
function ClickConnect() {
console.log('Working')
document
.querySelector('#top-toolbar > colab-connect-button')
.shadowRoot.querySelector('#connect')
.click()
}
intervalTiming = setInterval(ClickConnect, 60000)
Copy this code above to the page Console and press enter.
60000(ms) means that every 1 minute it clicks on the page.
If you don't know how to open the page Console, you can either press f12 or right_click + inspect then select the Console.
When you're done, you can reset this by typing the code bellow in the page Console:
clearInterval(intervalTiming);