Skip to content

Instantly share code, notes, and snippets.

@JesperDramsch
Last active January 20, 2023 17:08
Show Gist options
  • Save JesperDramsch/38319509e648c596f9600d3876415459 to your computer and use it in GitHub Desktop.
Save JesperDramsch/38319509e648c596f9600d3876415459 to your computer and use it in GitHub Desktop.
Simple script to create shields to view notebooks on Colab, Gradient, and AWS Studio
from pathlib import Path
## replace these
user = "jesperdramsch"
folder = "notebooks"
repo = "euroscipy-2022-ml-for-science-reproducibility-tutorial"
## Add a Binder link once
print(f"https://mybinder.org/v2/gh/{user}/{repo}/HEAD", "\n")
## Links to individual notebooks
for notebook in Path(folder).glob("*.ipynb"):
shields = [f"[![](https://img.shields.io/badge/view-notebook-orange)]({folder}/{notebook.name})",
f"[![](https://img.shields.io/badge/open-colab-yellow)](https://colab.research.google.com/github/{user}/{repo}/blob/main/{folder}/{notebook.name})",
f"[![Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://console.paperspace.com/github/{user}/{repo}/blob/main/{folder}/{notebook.name})",
f"[![Open In SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/{user}/{repo}/blob/main/{folder}/{notebook.name})",
f"[![Launch in Deepnote](https://deepnote.com/buttons/launch-in-deepnote-small.svg)](https://deepnote.com/launch?url=https%3A%2F%2Fgithub.com%2F{user}%2F{repo}%2Fblob%2Fmain%2F{folder}%2F{notebook.name})",]
print("\n" + str(notebook))
print(" ".join([shield.replace(" ", "%20") for shield in shields]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment