Add HUB-SDK Docs reference section (#7781)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
This commit is contained in:
Glenn Jocher 2024-01-27 00:21:31 +01:00 committed by GitHub
parent 5941128835
commit ee88882874
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 142 additions and 47 deletions

View file

@ -49,8 +49,9 @@ def build_docs(use_languages=False, clone_repos=True):
os.system(f"git clone {repo} {local_dir}")
os.system(f"git -C {local_dir} pull") # update repo
shutil.rmtree(DOCS / "en/hub/sdk", ignore_errors=True) # delete if exists
shutil.copytree(local_dir / "docs", DOCS / "en/hub/sdk")
shutil.rmtree(DOCS / "en/hub/sdk/reference") # temporarily delete reference until we find a solution for this
shutil.copytree(local_dir / "docs", DOCS / "en/hub/sdk") # for docs
shutil.rmtree(DOCS.parent / "hub_sdk", ignore_errors=True) # delete if exists
shutil.copytree(local_dir / "hub_sdk", DOCS.parent / "hub_sdk") # for mkdocstrings
print(f"Cloned/Updated {repo} in {local_dir}")
# Build the main documentation
@ -68,7 +69,7 @@ def build_docs(use_languages=False, clone_repos=True):
def update_html_links():
"""Update href links in HTML files to remove '.md' and '/index.md', excluding links starting with 'https://'."""
html_files = Path(SITE).rglob("*.html")
html_files = SITE.rglob("*.html")
total_updated_links = 0
for html_file in html_files:
@ -134,6 +135,27 @@ def update_html_head(script=""):
file.write(new_html_content)
def update_subdir_edit_links(subdir="", docs_url=""):
"""Update the HTML head section of each file."""
from bs4 import BeautifulSoup
if str(subdir[0]) == "/":
subdir = str(subdir[0])[1:]
html_files = (SITE / subdir).rglob("*.html")
for html_file in tqdm(html_files, desc="Processing subdir files"):
with html_file.open("r", encoding="utf-8") as file:
soup = BeautifulSoup(file, "html.parser")
# Find the anchor tag and update its href attribute
a_tag = soup.find("a", {"class": "md-content__button md-icon"})
if a_tag and a_tag["title"] == "Edit this page":
a_tag["href"] = f"{docs_url}{a_tag['href'].split(subdir)[-1]}"
# Write the updated HTML back to the file
with open(html_file, "w", encoding="utf-8") as file:
file.write(str(soup))
def main():
# Build the docs
build_docs()
@ -141,6 +163,12 @@ def main():
# Update titles
update_page_title(SITE / "404.html", new_title="Ultralytics Docs - Not Found")
# Update edit links
update_subdir_edit_links(
subdir="hub/sdk/", # do not use leading slash
docs_url="https://github.com/ultralytics/hub-sdk/tree/develop/docs/",
)
# Update HTML file head section
# update_html_head("")

View file

@ -9,7 +9,7 @@ keywords: Ultralytics, Explorer GUI, semantic search, vector similarity search,
Explorer GUI is like a playground build using [Ultralytics Explorer API](api.md). It allows you to run semantic/vector similarity search, SQL queries and even search using natural language using our ask AI feature powered by LLMs.
<p>
<img width="1709" alt="Explorer Dashboard Screenshot 1" src="https://github.com/AyushExel/assets/assets/15766192/f9c3c704-df3f-4209-81e9-c777b1f6ed9c">
<img width="1709" alt="Explorer Dashboard Screenshot 1" src="https://github.com/ultralytics/ultralytics/assets/15766192/feb1fe05-58c5-4173-a9ff-e611e3bba3d0">
</p>
<p align="center">

View file

@ -7,7 +7,7 @@ keywords: Ultralytics Explorer, CV Dataset Tools, Semantic Search, SQL Dataset Q
# Ultralytics Explorer
<p>
<img width="1709" alt="Ultralytics Explorer Screenshot 1" src="https://github.com/AyushExel/assets/assets/15766192/85675606-fb7f-4b0c-ad1b-d9d07c919414">
<img width="1709" alt="Ultralytics Explorer Screenshot 1" src="https://github.com/ultralytics/ultralytics/assets/15766192/feb1fe05-58c5-4173-a9ff-e611e3bba3d0">
</p>
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>

View file

@ -367,6 +367,25 @@ nav:
- Model: hub/sdk/model.md
- Dataset: hub/sdk/dataset.md
- Project: hub/sdk/project.md
- Reference:
- base:
- api_client: hub/sdk/reference/base/api_client.md
- auth: hub/sdk/reference/base/auth.md
- crud_client: hub/sdk/reference/base/crud_client.md
- paginated_list: hub/sdk/reference/base/paginated_list.md
- server_clients: hub/sdk/reference/base/server_clients.md
- helpers:
- error_handler: hub/sdk/reference/helpers/error_handler.md
- exceptions: hub/sdk/reference/helpers/exceptions.md
- logger: hub/sdk/reference/helpers/logger.md
- utils: hub/sdk/reference/helpers/utils.md
- hub_client: hub/sdk/reference/hub_client.md
- modules:
- datasets: hub/sdk/reference/modules/datasets.md
- models: hub/sdk/reference/modules/models.md
- projects: hub/sdk/reference/modules/projects.md
- teams: hub/sdk/reference/modules/teams.md
- users: hub/sdk/reference/modules/users.md
- REST API:
- hub/api/index.md

View file

@ -0,0 +1,22 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
# Author list used in docs publication actions
1579093407@qq.com: null
17216799+ouphi@users.noreply.github.com: ouphi
17316848+maianumerosky@users.noreply.github.com: maianumerosky
34196005+fcakyon@users.noreply.github.com: fcakyon
37276661+capjamesg@users.noreply.github.com: capjamesg
39910262+ChaoningZhang@users.noreply.github.com: ChaoningZhang
40165666+berry-ding@users.noreply.github.com: berry-ding
47978446+sergiuwaxmann@users.noreply.github.com: sergiuwaxmann
61612323+Laughing-q@users.noreply.github.com: Laughing-q
62214284+Burhan-Q@users.noreply.github.com: Burhan-Q
75611662+tensorturtle@users.noreply.github.com: tensorturtle
abirami.vina@gmail.com: abirami-vina
ayush.chaurarsia@gmail.com: AyushExel
chr043416@gmail.com: null
glenn.jocher@ultralytics.com: glenn-jocher
muhammadrizwanmunawar123@gmail.com: RizwanMunawar
not.committed.yet: null
shuizhuyuanluo@126.com: null
xinwang614@gmail.com: GreatV