Colab audio alarm or pop up notification to remind the user to click captcha button when popped up, prevent inactivity
Asked Answered
E

1

6

A meme to describe my problem

From March 2021 google colab has added a captcha that randomly pops up after some time. So it is difficult or not possible to programmatically prevent Google Colab from disconnecting on a timeout. So there's no option other than opening the tab and clicking the captcha button. I often run model which take more training time and sometimes miss going back to it in 90 mins. The captcha can be popped up even while the training is not completed and soon terminates after a few minutes if not clicked.

Are there any solutions so that I can at least get an audio notification when I get a captcha in colab or if not pop-up message in browser or OS so that I can know about the inactivity?

I had found some ways get notified at some target lines in the notebook, say after training is completed. One is the colab browser notification feature, can be checked to true in settings. Other one is an audio solution, you just add these 2 lines of code found here to get an alarm when the code executes at any line in a cell. What I am looking for is an alarm or pop up message in case of captcha.

Emotion answered 17/8, 2021 at 11:40 Comment(3)
Try Colab Pro+, which supports background execution without recaptcha prompts.Degreeday
@BobSmith yea that is one way to solve the problem but it's paid and costly. I am looking for free ones like a JS or any coding solutions if there could be any.Emotion
@bobSmith pro+ is the only solution? What about simply pro? Because the pro+ is really expensive...Cambridge
K
-1

This is probably a half-correct answer, but here's my shot at solving this

This article discusses how to bypass Captcha's, and has some code that clicks the check box if a captcha is found. I think it could be modified to have a sound alert instead.

However, Captchas were made to counter these sort of tools, plus I'm not sure about the legality implications etc, so I wouldn't recommend it.

The use of the below js increased the time before google sent a recaptcha for me. Btw, I set this as a bookmark, to call it whenever I need to. Executing the js bit in the console should be equivalent.

javascript:void(setInterval(function(){ console.log("Connect pushed"); document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click(); },60000))
Kazantzakis answered 26/8, 2021 at 14:16 Comment(1)
Any idea how to do this in Python?Niddering

© 2022 - 2024 — McMap. All rights reserved.