Skip to content

Instantly share code, notes, and snippets.

@emadehsan
Created January 29, 2020 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emadehsan/a304dbf8c5fc3d24b74da3fb24a9cb2b to your computer and use it in GitHub Desktop.
Save emadehsan/a304dbf8c5fc3d24b74da3fb24a9cb2b to your computer and use it in GitHub Desktop.
from IPython.display import display, Javascript
from google.colab.output import eval_js
from base64 import b64decode
def take_photo(filename='photo.jpg', quality=0.8):
js = Javascript('''
// ...
// JavaScript code here <<==
// ...
''')
# make the provided HTML, part of the cell
display(js)
# call the takePhoto() JavaScript function
data = eval_js('takePhoto({})'.format(quality))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment