Skip to content

Commit

Permalink
Add support for EDS-NLP library (#696)
Browse files Browse the repository at this point in the history
Hi,

This PR adds support for the edsnlp library (related to
huggingface/api-inference-community#424), an NLP
library developed at the Greater Paris University Hospitals (AP-HP) with
a specific focus on hybrid models (rule-based + ML) and multi-tasking,
widely used in the structuring of clinical language at scale (NER,
entity linking, document classification, event extraction, ...).
I saw that the file
https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/library-to-tasks.ts
was automatically generated from a GitHub CI as mentioned on the docs,
but didn't see how the action would edit it so I took the liberty of
modifying it myself.
Let me know if you need more information or if I need to change anything
about this PR, thanks !

---------

Co-authored-by: Lucain <[email protected]>
Co-authored-by: Omar Sanseviero <[email protected]>
  • Loading branch information
3 people authored Jun 17, 2024
1 parent 1bc70ac commit 1f4eb84
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ export const diffusers = (model: ModelData): string[] => {
}
};

export const edsnlp = (model: ModelData): string[] => {
const packageName = nameWithoutNamespace(model.id).replaceAll("-", "_");
return [
`# Load it from the Hub directly
import edsnlp
nlp = edsnlp.load("${model.id}")
`,
`# Or install it as a package
!pip install git+https://huggingface.co/${model.id}
# and import it as a module
import ${packageName}
nlp = ${packageName}.load() # or edsnlp.load("${packageName}")
`,
];
};

export const espnetTTS = (model: ModelData): string[] => [
`from espnet2.bin.tts_inference import Text2Speech
Expand Down
11 changes: 11 additions & 0 deletions packages/tasks/src/model-libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
repoName: "doctr",
repoUrl: "https://github.com/mindee/doctr",
},
edsnlp: {
prettyLabel: "EDS-NLP",
repoName: "edsnlp",
repoUrl: "https://github.com/aphp/edsnlp",
docsUrl: "https://aphp.github.io/edsnlp/latest/",
filter: false,
snippets: snippets.edsnlp,
countDownloads: {
wildcard: { path: "*/config.cfg" },
},
},
elm: {
prettyLabel: "ELM",
repoName: "elm",
Expand Down

0 comments on commit 1f4eb84

Please sign in to comment.