import React, { useState, useEffect, useMemo } from "react"; import { generateCalendarData } from "../utils/calendar"; import { OpenSourceHeatmapProps, ProviderInfo, ModelData, CalendarData, } from "../types/heatmap"; import Heatmap from "../components/Heatmap"; import { fetchAllProvidersData, fetchAllAuthorsData } from "../utils/authors"; import UserSearchDialog from "../components/UserSearchDialog"; import ProviderSummary from "../components/ProviderSummary"; import OrganizationCard from "../components/OrganizationCard"; import { getRankingBadge } from "../utils/ranking"; const PROVIDERS: ProviderInfo[] = [ { color: "#E91E63", authors: ["Baidu","PaddlePaddle"] }, { color: "#00BCD4", authors: ["tencent"] }, { color: "#FFD700", authors: ["BAAI"] }, { color: "#DC143C", authors: ["OpenGVLab","InternLM"] }, { color: "#FF4500", authors: ["Skywork"] }, { color: "#556B2F", authors: ["MiniMaxAI"] }, { color: "#7FFFD4", authors: ["stepfun-ai"] }, { color: "#FF6347", authors: ["ByteDance","Bytedance Seed","bytedance-research"]}, { color: "#9C27B0", authors: ["openbmb"] }, { color: "#607D8B", authors: ["THUDM"] }, { color: "#3F51B5", authors: ["rednote-hilab"] }, { color: "#DC143C", authors: ["deepseek-ai"] }, { color: "#FF4500", authors: ["Qwen", "wan-ai","wan-ai"]}, { color: "#009688", authors: ["XiaomiMiMo"] }, { color: "#8BC34A", authors: ["IndexTeam"] }, ]; export async function getStaticProps() { try { const allAuthors = PROVIDERS.flatMap(({ authors }) => authors); const uniqueAuthors = Array.from(new Set(allAuthors)); const flatData: ModelData[] = await fetchAllAuthorsData(uniqueAuthors); const updatedProviders = await fetchAllProvidersData(PROVIDERS); const calendarData = generateCalendarData(flatData, updatedProviders); return { props: { calendarData, providers: updatedProviders, }, revalidate: 3600, // regenerate every hour }; } catch (error) { console.error("Error fetching data:", error); return { props: { calendarData: {}, providers: PROVIDERS, }, revalidate: 60, // retry after 1 minute if there was an error }; } } const ProviderHeatmap = React.memo(({ provider, calendarData }: { provider: ProviderInfo, calendarData: CalendarData }) => { const providerName = provider.fullName || provider.authors[0]; const calendarKey = provider.authors[0]; // Use the same key as calendar generation const totalCount = calendarData[calendarKey]?.reduce((sum, day) => sum + day.count, 0) || 0; return (
{/* Organization Header */} {/* Heatmap Section */}
); }); const OpenSourceHeatmap: React.FC = ({ calendarData, providers, }) => { const [isLoading, setIsLoading] = useState(true); useEffect(() => { if (calendarData && Object.keys(calendarData).length > 0) { setIsLoading(false); } }, [calendarData]); const sortedProviders = useMemo(() => providers.sort((a, b) => { const aData = calendarData[a.authors[0]] || []; const bData = calendarData[b.authors[0]] || []; const aCount = aData.reduce((sum, day) => sum + day.count, 0); const bCount = bData.reduce((sum, day) => sum + day.count, 0); return bCount - aCount; }), [providers, calendarData] ); return (

Chinese AI Labs Heatmap

Open models, datasets, and apps from the top AI labs in the last year.

{/* Provider Summary List */}
{sortedProviders.map((provider, index) => ( ))}
{isLoading ? (

Loading heatmaps...

) : ( <>
{sortedProviders.slice(0, 3).map((provider, index) => ( ))}
{/* Rest of the providers */} {sortedProviders.length > 3 && (
{sortedProviders.slice(3).map((provider, index) => ( ))}
)} )} {/* CTA Section */}

Want Your Own Heatmap?

Search for any Hugging Face organization or user to see their model release activity.

); }; export default OpenSourceHeatmap;