From bc7381c50a4796abc58a531e6d832ef4afdc6cb6 Mon Sep 17 00:00:00 2001 From: Borg93 <48671678+Borg93@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:55:44 +0100 Subject: [PATCH] Add HTRflow as a library (#1008) This PR adds https://github.com/AI-Riksarkivet/htrflow/ as a library. --------- Co-authored-by: vb Co-authored-by: Lucain --- packages/tasks/src/model-libraries-snippets.ts | 17 +++++++++++++++++ packages/tasks/src/model-libraries.ts | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts index fc4280533..fa5c87753 100644 --- a/packages/tasks/src/model-libraries-snippets.ts +++ b/packages/tasks/src/model-libraries-snippets.ts @@ -363,6 +363,23 @@ export const gliner = (model: ModelData): string[] => [ model = GLiNER.from_pretrained("${model.id}")`, ]; +export const htrflow = (model: ModelData): string[] => [ + `# CLI usage +# see docs: https://ai-riksarkivet.github.io/htrflow/latest/getting_started/quick_start.html +htrflow pipeline `, + `# Python usage +from htrflow.pipeline.pipeline import Pipeline +from htrflow.pipeline.steps import Task +from htrflow.models.framework.model import ModelClass + +pipeline = Pipeline( + [ + Task( + ModelClass, {"model": "${model.id}"}, {} + ), + ])`, +]; + export const keras = (model: ModelData): string[] => [ `# Available backend options are: "jax", "torch", "tensorflow". import os diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts index 224759c36..e25550640 100644 --- a/packages/tasks/src/model-libraries.ts +++ b/packages/tasks/src/model-libraries.ts @@ -317,6 +317,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = { docsUrl: "https://hezarai.github.io/hezar", countDownloads: `path:"model_config.yaml" OR path:"embedding/embedding_config.yaml"`, }, + htrflow: { + prettyLabel: "HTRflow", + repoName: "HTRflow", + repoUrl: "https://github.com/AI-Riksarkivet/htrflow", + docsUrl: "https://ai-riksarkivet.github.io/htrflow", + snippets: snippets.htrflow, + }, "hunyuan-dit": { prettyLabel: "HunyuanDiT", repoName: "HunyuanDiT",