Skip to content

Instantly share code, notes, and snippets.

@jexp
Created June 8, 2021 22:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jexp/2c85421842220521b361fd6f2ecb7799 to your computer and use it in GitHub Desktop.
Save jexp/2c85421842220521b361fd6f2ecb7799 to your computer and use it in GitHub Desktop.
Random Giphy images in Jupyter notebook to keep your audience entertained while they wait for data processing
!pip install giphy_client
import giphy_client
import random
from IPython.core.display import display, HTML
api_instance = giphy_client.DefaultApi()
api_key = '***' # from https://developers.giphy.com/dashboard/
search = 'science'
api_response = api_instance.gifs_search_get( api_key, search, limit=25)
images = [img.images.fixed_height.url for img in api_response.data]
# cell 2
display(HTML("<img src='%s' height='200'/>" % random.choice(images)))
@jexp
Copy link
Author

jexp commented Jun 8, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment