Skip to content

Commit

Permalink
docs: colab task examples (#40)
Browse files Browse the repository at this point in the history
* feat: add notebook docs draft

* fix: styling of notebook documentation

* feat: add notebook util to help setup ssh key

* fix: styling of code in markdown cells of notebooks

* docs: add twin project label migration to notebook docs

* docs: finish migrating task examples to notebooks

* docs: clean up old examples

* docs: format code

* docs(fix): auth comment out one of the two auth options

* docs: ruff fmt

* docs: attempt to fix auth logos

* fix: typo
  • Loading branch information
frederik-encord authored Jan 10, 2025
1 parent 3f4c72c commit e790c9f
Show file tree
Hide file tree
Showing 16 changed files with 2,758 additions and 385 deletions.
77 changes: 0 additions & 77 deletions docs/code_examples/tasks/prelabel_videos.py

This file was deleted.

18 changes: 0 additions & 18 deletions docs/code_examples/tasks/prioritize_by_data_title.py

This file was deleted.

55 changes: 0 additions & 55 deletions docs/code_examples/tasks/twin_project.py

This file was deleted.

15 changes: 0 additions & 15 deletions docs/code_examples/tasks/wrong_stage_and_pathway_names.py

This file was deleted.

370 changes: 370 additions & 0 deletions docs/notebooks/prelabel_videos_with_bounding_boxes.ipynb

Large diffs are not rendered by default.

274 changes: 274 additions & 0 deletions docs/notebooks/task_agent_set_priority.ipynb

Large diffs are not rendered by default.

386 changes: 386 additions & 0 deletions docs/notebooks/twin_project_label_transfer.ipynb

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions docs/overrides/partials/content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!--
Copyright (c) 2016-2024 Martin Donath <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->

<!-- Tags -->
{% if "material/tags" in config.plugins and tags %} {% include
"partials/tags.html" %} {% endif %}

<!-- Actions -->
{% include "partials/actions.html" %}

<!--
Hack: check whether the content contains a h1 headline. If it doesn't, the
page title (or respectively site name) is used as the main headline.
-->


{% if "\x3ch1" not in page.content %}
<h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %}

{% if page.nb_url %}
{% include "partials/notebook_links.html" %}
{% endif %}

<!-- Page content -->
{{ page.content }}

{% if page.nb_url %}
{% include "partials/notebook_links.html" %}
{% endif %}

<!-- Source file information -->
{% include "partials/source-file.html" %}


<!-- Was this page helpful? -->
{% include "partials/feedback.html" %}

<!-- Comment system -->
{% include "partials/comments.html" %}
42 changes: 42 additions & 0 deletions docs/overrides/partials/notebook_links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% set page_url_parts = page.nb_url.split('/') %}
{% set gh_ns = namespace(gh_nb_url='') %} {# Create a namespace to store the variable #}
{% for page_url_part in page_url_parts %}
{% if loop.index + 1 < page_url_parts | length %}
{% set gh_ns.gh_nb_url = gh_ns.gh_nb_url + page_url_part %}
{% set gh_ns.gh_nb_url = gh_ns.gh_nb_url + '/' %}
{% elif loop.index == page_url_parts | length %}
{% set gh_ns.gh_nb_url = gh_ns.gh_nb_url + page_url_part %}
{% endif %}
{% endfor %}
<div style="display: flex; justify-content: center; column-gap: 2em;">
<a
href="{{ config.repo_url }}/blob/{{ config.branch_name }}/docs{{ gh_ns.gh_nb_url }}"
target="_blank"
rel="noopener noreferrer"
>
<span class="md-source-file__fact">
<span class="md-icon">{% include ".icons/material/github.svg" %}</span>
View on Github
</span>
</a>
<a
href="{{ config.colab_prefix }}/blob/{{ config.branch_name }}/docs{{ gh_ns.gh_nb_url }}"
target="_blank"
rel="noopener noreferrer"
>
<span class="md-source-file__fact">
<span class="md-icon">{% include ".icons/simple/googlecolab.svg" %}</span>
Try in Colab
</span>
</a>
<a
href="{{ page.nb_url }}"
target="_blank"
rel="noopener noreferrer"
>
<span class="md-source-file__fact">
<span class="md-icon">{% include ".icons/material/download.svg" %}</span>
Download notebook
</span>
</a>
</div>
4 changes: 4 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Hack to make code in markdown cells of notebooks look similar to actual code */
div.jp-MarkdownCell pre {
font-size: var(--jp-code-font-size);
}
Loading

0 comments on commit e790c9f

Please sign in to comment.