How to Use Models Not Shown in HuggingFace Observable Examples (e.g., Midas for Depth)

Hello everyone!

I’ve been exploring the HuggingFace JS inference examples (Hello Huggingface.js Inference / Hugging Face | Observable) and I am really impressed with the power of these models. However, I am interested in using a specific model not shown in the examples, and I need some guidance on how to adapt the code to make it work.

The model I am trying to use is the Intel’s dpt-hybrid-midas (Intel/dpt-hybrid-midas · Hugging Face), which uses Midas for depth estimation. I have been trying to modify the code provided in the examples to make it compatible with this model, but I haven’t had any success yet.

Has anyone managed to use a model like this with the HuggingFace JS inference? If so, I would really appreciate any tips or code snippets to help me get started.

I am particularly having trouble with the input and output formats, as well as understanding the model-specific parameters and whether all models can be using HuggingFace Js or only a few selected onces are supported? Any assistance or pointers to resources that can help me understand how to work with this particular model would be greatly appreciated.

Thank you in advance for your help!

Anyone got any tips?