Caleb Fahlgren commited on
Commit
eb17fc6
·
1 Parent(s): 6aaff3e

update readme

Browse files
Files changed (3) hide show
  1. README.md +6 -0
  2. components/pie-chart.tsx +8 -13
  3. stats.png +0 -0
README.md CHANGED
@@ -1 +1,7 @@
1
  # Hugging Face Hub Stats
 
 
 
 
 
 
 
1
  # Hugging Face Hub Stats
2
+
3
+ - Powered by DuckDB WASM 🦆
4
+ - [Dataset](https://huggingface.co/datasets/cfahlgren1/hub-stats) updated on HuggingFace
5
+
6
+ ![HF Stats](./stats.png)
7
+
components/pie-chart.tsx CHANGED
@@ -37,20 +37,15 @@ export function CustomPieChart({
37
  dataKey,
38
  }: PieChartProps) {
39
  const chartColors = [
40
- "hsl(var(--chart-1))",
41
- "hsl(var(--chart-2))",
42
- "hsl(var(--chart-3))",
43
- "hsl(var(--chart-4))",
44
  "hsl(var(--chart-5))",
 
 
 
 
45
  ]
46
 
47
- // Sort data by value in descending order
48
  const sortedData = [...data].sort((a, b) => b.value - a.value)
49
-
50
- // Take top 4 items
51
  const topItems = sortedData.slice(0, 4)
52
-
53
- // Sum the rest under "Other"
54
  const otherValue = sortedData
55
  .slice(4)
56
  .reduce((sum, item) => sum + item.value, 0)
@@ -58,16 +53,16 @@ export function CustomPieChart({
58
  const chartData =
59
  otherValue > 0
60
  ? [
61
- ...topItems,
62
- { name: "Other", value: otherValue, fill: chartColors[4] },
63
- ]
64
  : topItems
65
 
66
  return (
67
  <Card className="bg-[var(--card-background)]">
68
  <CardHeader className="items-center pb-0">
69
  <CardTitle className="text-[var(--card-text)]">{title}</CardTitle>
70
- {description && ( // Conditionally render CardDescription
71
  <CardDescription className="text-[var(--card-text)]">
72
  {description}
73
  </CardDescription>
 
37
  dataKey,
38
  }: PieChartProps) {
39
  const chartColors = [
 
 
 
 
40
  "hsl(var(--chart-5))",
41
+ "hsl(var(--chart-4))",
42
+ "hsl(var(--chart-3))",
43
+ "hsl(var(--chart-2))",
44
+ "hsl(var(--chart-1))",
45
  ]
46
 
 
47
  const sortedData = [...data].sort((a, b) => b.value - a.value)
 
 
48
  const topItems = sortedData.slice(0, 4)
 
 
49
  const otherValue = sortedData
50
  .slice(4)
51
  .reduce((sum, item) => sum + item.value, 0)
 
53
  const chartData =
54
  otherValue > 0
55
  ? [
56
+ ...topItems,
57
+ { name: "Other", value: otherValue, fill: chartColors[4] },
58
+ ]
59
  : topItems
60
 
61
  return (
62
  <Card className="bg-[var(--card-background)]">
63
  <CardHeader className="items-center pb-0">
64
  <CardTitle className="text-[var(--card-text)]">{title}</CardTitle>
65
+ {description && (
66
  <CardDescription className="text-[var(--card-text)]">
67
  {description}
68
  </CardDescription>
stats.png ADDED