Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/inference/landing/np…
Browse files Browse the repository at this point in the history
…m_and_yarn-a2e1b812f4
  • Loading branch information
yeldarby authored Jan 4, 2025
2 parents d17646a + d9e8b47 commit 8f7d3fe
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 93 deletions.
85 changes: 70 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,95 @@ on:
release:
types: [created]
workflow_dispatch:
inputs:
deploy:
description: "Deploy docs?"
type: boolean
required: false
default: false

jobs:
deploy:
runs-on: depot-ubuntu-22.04-small
timeout-minutes: 20
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Check out inference repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
path: inference_repo
- uses: actions/checkout@v4

- name: Create GitHub App token (enterprise blocks)
id: enterprise_blocks_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.ENTERPRISE_BLOCKS_APP_ID }}
private-key: ${{ secrets.ENTERPRISE_BLOCKS_PEM }}
owner: roboflow
repositories: workflows-enterprise-blocks

- name: Check out enterprise blocks
uses: actions/checkout@v4
with:
repository: roboflow/workflows-enterprise-blocks
ref: main
path: roboflow_enterprise_blocks
token: ${{ secrets.GH_TOKEN_FOR_WORKFLOWS_ENTERPRISE }}
- uses: actions/setup-python@v5
token: ${{ steps.enterprise_blocks_token.outputs.token }}

- name: Create GitHub App token (mkdocs)
id: mkdocs_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.MKDOCS_APP_ID }}
private-key: ${{ secrets.MKDOCS_PEM }}
owner: roboflow
repositories: mkdocs-material-insiders

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
check-latest: true
- run: pip install -r requirements/requirements.docs.txt
working-directory: ./inference_repo
- run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
pip install -r requirements/_requirements.txt -r requirements/requirements.cpu.txt -r requirements/requirements.sdk.http.txt -r requirements/requirements.test.unit.txt -r requirements/requirements.test.integration.txt -r requirements/requirements.http.txt

- name: Install Python dependencies
run: |
# Upgrade pip and setuptools
python -m pip install --upgrade pip setuptools
# Install mkdocs-material-insiders using the GitHub App token
pip install git+https://roboflow:${{ steps.mkdocs_token.outputs.token }}@github.com/roboflow/mkdocs-material-insiders.git
# Install doc requirements
pip install -r requirements/requirements.docs.txt
# Install remaining dependencies
pip install -r requirements/_requirements.txt \
-r requirements/requirements.cpu.txt \
-r requirements/requirements.sdk.http.txt \
-r requirements/requirements.test.unit.txt \
-r requirements/requirements.test.integration.txt \
-r requirements/requirements.http.txt
working-directory: ./inference_repo
- run: pip install .

- name: Install enterprise blocks
run: pip install .
working-directory: ./roboflow_enterprise_blocks
- run: |
python -m development.docs.build_block_docs
WORKFLOWS_GALLERY_API_KEY=${{ secrets.WORKFLOWS_GALLERY_API_KEY }} python -m development.docs.workflows_gallery_builder

- name: Build block docs
run: python -m development.docs.build_block_docs
working-directory: ./inference_repo

- name: Build workflows gallery
env:
WORKFLOWS_GALLERY_API_KEY: ${{ secrets.WORKFLOWS_GALLERY_API_KEY }}
run: python -m development.docs.workflows_gallery_builder
working-directory: ./inference_repo
- run: mkdocs gh-deploy --force

- name: Deploy docs
# Only deploy if release event OR if deploy input was set to true
if: ${{ github.event_name == 'release' || github.event.inputs.deploy == 'true' }}
run: mkdocs gh-deploy --force
working-directory: ./inference_repo
7 changes: 4 additions & 3 deletions development/docs/build_block_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@


BLOCK_VERSION_TEMPLATE = """
## Version `{version}`
{description}
### Type identifier
Expand All @@ -72,13 +70,15 @@
The **Refs** column marks possibility to parametrise the property with dynamic values available
in `workflow` runtime. See *Bindings* for more info.
### Available Connections
### Available Connections {{ data-search-exclude }}
Check what blocks you can connect to `{family_name}` in version `{version}`.
- inputs: {input_connections}
- outputs: {output_connections}
### Input and Output Bindings
The available connections depend on its binding kinds. Check what binding kinds
`{family_name}` in version `{version}` has.
Expand Down Expand Up @@ -283,6 +283,7 @@ def main() -> None:
)
block_card_lines.append(block_card_line)

block_card_lines = sorted(block_card_lines)
lines = lines[: start_index + 1] + block_card_lines + lines[end_index:]
dump_text_lines(
path=BLOCK_DOCUMENTATION_FILE,
Expand Down
63 changes: 60 additions & 3 deletions development/docs/workflows_gallery_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
))
WORKFLOWS_DOCS_ROOT_PATH = os.path.join(DOCS_ROOT, "workflows")

GALLERY_INDEX_PATH = os.path.join(WORKFLOWS_DOCS_ROOT_PATH, "gallery_index.md")
GALLERY_DIR = os.path.join(WORKFLOWS_DOCS_ROOT_PATH, "gallery")
GALLERY_INDEX_TEMPLATE = os.path.join(WORKFLOWS_DOCS_ROOT_PATH, "gallery_index_template.md")
GALLERY_INDEX_PATH = os.path.join(WORKFLOWS_DOCS_ROOT_PATH, "gallery", "index.md")
GALLERY_DIR_PATH = os.path.join(WORKFLOWS_DOCS_ROOT_PATH, "gallery")


Expand All @@ -55,7 +57,11 @@ def categorise_gallery(gallery: List[WorkflowGalleryEntry]) -> Dict[str, List[Wo


def generate_gallery_index(categories: List[str]) -> None:
index = read_file(path=GALLERY_INDEX_PATH)
# move the Basic Workflows category to the start
basic_workflows_index = categories.index("Basic Workflows")
categories.insert(0, categories.pop(basic_workflows_index))

index = read_file(path=GALLERY_INDEX_TEMPLATE)
index_lines = index.split("\n")
list_start_index = find_line_with_marker(lines=index_lines, marker='<ul id="workflows-gallery">')
list_end_index = find_line_with_marker(lines=index_lines, marker="</ul>")
Expand All @@ -65,15 +71,66 @@ def generate_gallery_index(categories: List[str]) -> None:
f'\t<li><a href="{generate_gallery_page_link(category=category)}">{category}</a></li>'
for category in categories
]

new_index = index_lines[:list_start_index + 1]
new_index.extend(categories_entries)
new_index.extend(index_lines[list_end_index:])
new_index_content = "\n".join(new_index)
write_file(path=GALLERY_INDEX_PATH, content=new_index_content)

write_gallery_summary_md(categories)

def to_title_case(s: str) -> str:
"""
Convert e.g. 'object_detection' -> 'Object Detection'
"""
words = re.split(r'[_\s]+', s.lower())
return " ".join(w.capitalize() for w in words if w)

def write_gallery_summary_md(categories: List[str]) -> None:
"""
Creates docs/workflows/gallery/SUMMARY.md for mkdocs-literate-nav.
"""
lines = []

for category in categories:
url = generate_gallery_page_link(category=category)

# relative links (remove `/workflows/gallery/` prefix)
url = url.replace("/workflows/gallery/", "")

url = f"{url}.md"

category = category.replace("Workflows with ", "")
category = category.replace("Workflows for ", "")
category = category.replace("Workflows ", "")
category = category.replace(" in Workflows", "")

if category == "Filtering resulting data based on value delta change":
category = "Filtering Data"

if category == "Enhanced by Roboflow Platform":
category = "Enhanced by Roboflow"

if category == "Advanced Inference Techniques":
category = "Advanced Techniques"

if category == "Integration With External Apps":
category = "External Integrations"

category = to_title_case(category)

if category == "Ocr":
category = "OCR"

lines.append(f"* [{category}]({url})")

summary_path = os.path.join(GALLERY_DIR, "SUMMARY.md")
with open(summary_path, "w", encoding="utf-8") as f:
f.write("\n".join(lines) + "\n")

GALLERY_PAGE_TEMPLATE = """
# Example Workflows - {category}
# {category}
Below you can find example workflows you can use as inspiration to build your apps.
Expand Down
2 changes: 0 additions & 2 deletions docs/cookbooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ hide:
- navigation
- toc
---
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.8/purify.min.js"></script>
<link rel="stylesheet" href="/styles/cookbooks.css">
<script src="/javascript/cookbooks.js"></script>
<section class="mdx-container portfolio-section">
<div class="md-grid md-typeset">
<div class="text-center">
Expand Down
25 changes: 25 additions & 0 deletions docs/fine-tuned/yolov11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[YOLOv11](https://yolov11.com), released in September 2024, is a real-time object detection model developed by Ultralytics.

## Supported Model Types

You can deploy the following YOLOv11 model types with Inference:

- Object Detection
- Image Segmentation
- Keypoint Detection

## Supported Inputs

Click a link below to see instructions on how to run a YOLOv10 model on different inputs:

- [Image](/quickstart/run_model_on_image/)
- [Video, Webcam, or RTSP Stream](/quickstart/run_model_on_rtsp_webcam/)

## License

See our [Licensing Guide](https://roboflow.com/licensing) for more information about how your use of YOLOv11 is licensed when using Inference to deploy your model.

## See Also

- [What is YOLOv11? An Introduction](https://blog.roboflow.com/what-is-yolo11/)
- [How to Train a YOLOv11 Model](https://blog.roboflow.com/yolov11-how-to-train-custom-data/)
6 changes: 4 additions & 2 deletions docs/javascript/cookbooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

document.addEventListener("DOMContentLoaded", function () {
function render() {

async function setCard(el, url, name, desc, labels, theme, authors) {
const colorList = [
Expand Down Expand Up @@ -102,4 +102,6 @@ document.addEventListener("DOMContentLoaded", function () {

setCard(el, url, name, desc, labels, theme, authors);
}
})
}

document$.subscribe(render);
9 changes: 5 additions & 4 deletions docs/javascript/workflows.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

document.addEventListener("DOMContentLoaded", function () {

function render() {
const colorList = [
"#22c55e",
"#14b8a6",
Expand All @@ -25,7 +24,7 @@ document.addEventListener("DOMContentLoaded", function () {
}, {});

async function setCard(el, url, name, desc, labels, theme, authors) {
console.log(name, desc)
// console.log(name, desc)
let labelHTML = ''
if (labels) {
const labelArray = labels.split(',').map((label, index) => {
Expand Down Expand Up @@ -75,4 +74,6 @@ document.addEventListener("DOMContentLoaded", function () {

setCard(el, url, name, desc, labels, theme, authors);
}
})
};

document$.subscribe(render);
1 change: 0 additions & 1 deletion docs/workflows/blocks_gallery_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ hide:
---
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.8/purify.min.js"></script>
<link rel="stylesheet" href="/styles/workflows.css">
<script src="/javascript/workflows.js"></script>
<section class="mdx-container portfolio-section">
<div class="md-grid md-typeset">
<div class="text-center">
Expand Down
22 changes: 0 additions & 22 deletions docs/workflows/gallery_index.md

This file was deleted.

7 changes: 7 additions & 0 deletions docs/workflows/gallery_index_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Workflows gallery

The Workflows gallery offers example workflow definitions to help you understand what can be achieved with workflows.
Browse through the various categories to find inspiration and ideas for building your own workflows.

<ul id="workflows-gallery">
</ul>
Loading

0 comments on commit 8f7d3fe

Please sign in to comment.