Skip to content

Live/auto-fetching model info #55

@varunneal

Description

@varunneal

I noticed the # downloads and # likes in the model dropdown is hard coded. I dug around into the Huggingface Hub API and found that we can access this info via GET requests. Here's an example of doing it for gte-mini:

const url = "https://huggingface.co/api/models/TaylorAI/gte-tiny";
const headers = {
    "user-agent": "unknown/None;",
    "Accept-Encoding": "gzip, deflate",
    "Accept": "*/*",
    "Connection": "keep-alive",
};

fetch(url, { method: 'GET', headers: headers })
    .then(response => response.json())  
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

You can enter the following code in the JS console to verify it works. The downloads and likes entries directly get us those values, but the model size is a bit harder, especially because we are hardcoding the size of the Onyx model. I'm not sure if we can even get that value.

Additionally, I want to ask @do-me what it means when a model has many different download sizes in the dropdown, e.g. snowflake-arctic-embed-xs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions