Spaces:
Running
Running
File size: 575 Bytes
b10df03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
export const fetchAllPages = async () => {
const filter_key = "zero-a10g";
const pageNumbers = Array.from({ length: 200 }, (_, i) => i);
const urls = pageNumbers.map(async (pageNumber) => {
const url = `https://huggingface.co/spaces-json?p=${pageNumber}&sort=trending`;
const response = await fetch(url);
const json = await response.json();
return json?.spaces ?? [];
});
const jsonResponses = await Promise.all(urls);
const spaces = jsonResponses.flat()?.filter((space) => space?.runtime?.hardware?.current === filter_key);
return spaces;
}; |