Skip to content

Commit 1f4eb84

Browse files
percevalwWauplinosanseviero
authored
Add support for EDS-NLP library (#696)
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]>
1 parent 1bc70ac commit 1f4eb84

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ export const diffusers = (model: ModelData): string[] => {
9797
}
9898
};
9999

100+
export const edsnlp = (model: ModelData): string[] => {
101+
const packageName = nameWithoutNamespace(model.id).replaceAll("-", "_");
102+
return [
103+
`# Load it from the Hub directly
104+
import edsnlp
105+
nlp = edsnlp.load("${model.id}")
106+
`,
107+
`# Or install it as a package
108+
!pip install git+https://huggingface.co/${model.id}
109+
110+
# and import it as a module
111+
import ${packageName}
112+
113+
nlp = ${packageName}.load() # or edsnlp.load("${packageName}")
114+
`,
115+
];
116+
};
117+
100118
export const espnetTTS = (model: ModelData): string[] => [
101119
`from espnet2.bin.tts_inference import Text2Speech
102120

packages/tasks/src/model-libraries.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
133133
repoName: "doctr",
134134
repoUrl: "https://github.com/mindee/doctr",
135135
},
136+
edsnlp: {
137+
prettyLabel: "EDS-NLP",
138+
repoName: "edsnlp",
139+
repoUrl: "https://github.com/aphp/edsnlp",
140+
docsUrl: "https://aphp.github.io/edsnlp/latest/",
141+
filter: false,
142+
snippets: snippets.edsnlp,
143+
countDownloads: {
144+
wildcard: { path: "*/config.cfg" },
145+
},
146+
},
136147
elm: {
137148
prettyLabel: "ELM",
138149
repoName: "elm",

0 commit comments

Comments
 (0)