Skip to content

Commit 732cd1f

Browse files
committed
Add support for EDS-NLP library
1 parent fffe16e commit 732cd1f

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

packages/tasks/src/library-to-tasks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const LIBRARY_TASK_MAPPING: Partial<Record<ModelLibraryKey, PipelineType[
1818
bertopic: ["text-classification"],
1919
diffusers: ["image-to-image", "text-to-image"],
2020
doctr: ["object-detection"],
21+
edsnlp: ["token-classification"],
2122
espnet: ["text-to-speech", "automatic-speech-recognition"],
2223
fairseq: ["text-to-speech", "audio-to-audio"],
2324
fastai: ["image-classification"],

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

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

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

packages/tasks/src/model-libraries.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
125125
repoName: "doctr",
126126
repoUrl: "https://github.com/mindee/doctr",
127127
},
128+
edsnlp: {
129+
prettyLabel: "EDS-NLP",
130+
repoName: "edsnlp",
131+
repoUrl: "https://github.com/aphp/edsnlp",
132+
filter: false,
133+
snippets: snippets.edsnlp,
134+
countDownloads: {
135+
wildcard: { path: "*/config.cfg" },
136+
},
137+
},
128138
elm: {
129139
prettyLabel: "ELM",
130140
repoName: "elm",

0 commit comments

Comments
 (0)