Created
January 29, 2020 15:49
-
-
Save emadehsan/a304dbf8c5fc3d24b74da3fb24a9cb2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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