Skip to content
Merged
10 changes: 10 additions & 0 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,16 @@ export const vfimamba = (model: ModelData): string[] => [
model = Model.from_pretrained("${model.id}")`,
];

export const lvface = (model: ModelData): string[] => [
`from huggingface_hub import hf_hub_download
from inference_onnx import LVFaceONNXInferencer

model_path = hf_hub_download("${model.id}", "LVFace-L_Glint360K/LVFace-L_Glint360K.onnx")
inferencer = LVFaceONNXInferencer(model_path, use_gpu=True, timeout=300)
img_path = 'path/to/image1.jpg'
embedding = inferencer.infer_from_image(img_path)`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for nit-picking, but img_path is not defined so this snippet is not runnable as is. Users tend to copy/paste to test, so the less friction the better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for nit-picking, but img_path is not defined so this snippet is not runnable as is. Users tend to copy/paste to test, so the less friction the better.

Thank you for the reminder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please define img_path, so the snippet runs assuming all dependencies are installed?

];

export const voicecraft = (model: ModelData): string[] => [
`from voicecraft import VoiceCraft

Expand Down
7 changes: 7 additions & 0 deletions packages/tasks/src/model-libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
countDownloads: `path_extension:"pkl"`,
snippets: snippets.vfimamba,
},
lvface: {
prettyLabel: "LVFace",
repoName: "LVFace",
repoUrl: "https://github.com/bytedance/LVFace",
countDownloads: `path_extension:"pt" OR path_extension:"onnx"`,
snippets: snippets.lvface,
},
voicecraft: {
prettyLabel: "VoiceCraft",
repoName: "VoiceCraft",
Expand Down
Loading