Skip to content

Commit

Permalink
Merge branch 'vb/add-tgi-local-app' of https://github.com/huggingface…
Browse files Browse the repository at this point in the history
…/huggingface.js into vb/add-tgi-local-app
  • Loading branch information
Vaibhavs10 committed Oct 10, 2024
2 parents 425f50d + d622ad3 commit 7e8e4cc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,32 @@ depth = model.infer_image(raw_img) # HxW raw depth map in numpy
];
};

export const depth_pro = (model: ModelData): string[] => {
const installSnippet = `# Download checkpoint
pip install huggingface-hub
huggingface-cli download --local-dir checkpoints ${model.id}`;

const inferenceSnippet = `import depth_pro
# Load model and preprocessing transform
model, transform = depth_pro.create_model_and_transforms()
model.eval()
# Load and preprocess an image.
image, _, f_px = depth_pro.load_rgb("example.png")
image = transform(image)
# Run inference.
prediction = model.infer(image, f_px=f_px)
# Results: 1. Depth in meters
depth = prediction["depth"]
# Results: 2. Focal length in pixels
focallength_px = prediction["focallength_px"]`;

return [installSnippet, inferenceSnippet];
};

const diffusersDefaultPrompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k";

const diffusers_default = (model: ModelData) => [
Expand Down
8 changes: 8 additions & 0 deletions packages/tasks/src/model-libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
filter: false,
countDownloads: `path_extension:"pth"`,
},
"depth-pro": {
prettyLabel: "Depth Pro",
repoName: "Depth Pro",
repoUrl: "https://github.com/apple/ml-depth-pro",
countDownloads: `path_extension:"pt"`,
snippets: snippets.depth_pro,
filter: false,
},
diffree: {
prettyLabel: "Diffree",
repoName: "Diffree",
Expand Down

0 comments on commit 7e8e4cc

Please sign in to comment.