cfahlgren1 HF staff commited on
Commit
b9b05e2
1 Parent(s): 91d7c85

styling, build

Browse files
.github/workflows/deploy.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Hugging Face Spaces
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build-and-deploy:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Set up Node.js
18
+ uses: actions/setup-node@v3
19
+ with:
20
+ node-version: '20'
21
+
22
+ - name: Install dependencies
23
+ run: npm ci
24
+
25
+ - name: Build project
26
+ run: npm run build
27
+
28
+ - name: Copy README to dist
29
+ run: cp README.md dist/
30
+
31
+ - name: Push to Hugging Face Spaces
32
+ env:
33
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
34
+ run: |
35
+ cd dist
36
+ git init
37
+ git config user.email "github-actions[bot]@users.noreply.github.com"
38
+ git config user.name "github-actions[bot]"
39
+ git add .
40
+ git commit -m "Update build artifacts and README"
41
+ git push --force https://${{ secrets.HF_USERNAME }}:$HF_TOKEN@huggingface.co/spaces/${{ secrets.HF_USERNAME }}/${{ secrets.SPACE_NAME }} HEAD:main
.gitignore CHANGED
@@ -5,6 +5,7 @@
5
  /.pnp
6
  .pnp.js
7
  .yarn/install-state.gz
 
8
 
9
  # testing
10
  /coverage
 
5
  /.pnp
6
  .pnp.js
7
  .yarn/install-state.gz
8
+ /dist
9
 
10
  # testing
11
  /coverage
README.md CHANGED
@@ -1,4 +1,14 @@
1
- This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
 
 
 
 
 
 
 
 
 
 
2
 
3
  ## Getting Started
4
 
@@ -15,22 +25,3 @@ bun dev
15
  ```
16
 
17
  Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
-
21
- This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
-
23
- ## Learn More
24
-
25
- To learn more about Next.js, take a look at the following resources:
26
-
27
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
-
30
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
-
32
- ## Deploy on Vercel
33
-
34
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
-
36
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
 
1
+ ---
2
+ title: Transformers.js Playground
3
+ emoji: 🛝
4
+ colorFrom: indigo
5
+ colorTo: purple
6
+ sdk: static
7
+ pinned: false
8
+ ---
9
+ # Transformers.js Playground
10
+
11
+ ![Transformers.js Playground](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/webllm/shot.png)
12
 
13
  ## Getting Started
14
 
 
25
  ```
26
 
27
  Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
components/CategoryCard.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import React from 'react';
2
  import type { Category } from '../types/categories';
3
- import { getColorConfig } from '@/lib/utils';
4
 
5
  type CategoryCardProps = Category;
6
 
@@ -12,14 +12,14 @@ const CategoryCard: React.FC<CategoryCardProps> = ({
12
  status,
13
  graphic: Graphic
14
  }) => {
15
- const { text, gradient, iconBg } = getColorConfig(colorName);
16
  const isComingSoon = status === 'Coming Soon';
17
 
18
  return (
19
- <div className={`bg-gradient-to-br ${gradient} rounded-xl p-4 text-white w-92 h-[380px] flex flex-col relative shadow-lg transition-transform duration-300 ease-in-out hover:scale-105`}>
20
  {(status === 'New' || status === 'Coming Soon') && (
21
- <div className={`absolute top-2 right-2 ${iconBg} ${text} text-xs font-bold py-1 px-2 rounded-full`}>
22
- New
23
  </div>
24
  )}
25
  <div className="flex items-center mb-3">
@@ -31,7 +31,7 @@ const CategoryCard: React.FC<CategoryCardProps> = ({
31
  <div className="mb-3 flex-grow">
32
  <Graphic />
33
  </div>
34
- <p className="text-xs mb-3 leading-tight">{description}</p>
35
  <button
36
  className={`w-full bg-white ${text} py-2 px-3 rounded-lg text-sm font-semibold transition-colors mt-auto ${
37
  isComingSoon ? 'opacity-50 cursor-not-allowed' : 'hover:bg-opacity-90'
 
1
  import React from 'react';
2
  import type { Category } from '../types/categories';
3
+ import { getColorConfig } from '../lib/utils';
4
 
5
  type CategoryCardProps = Category;
6
 
 
12
  status,
13
  graphic: Graphic
14
  }) => {
15
+ const { bg, text, gradient, iconBg } = getColorConfig(colorName);
16
  const isComingSoon = status === 'Coming Soon';
17
 
18
  return (
19
+ <div className={`rounded-xl p-4 text-white w-92 h-[380px] flex flex-col relative shadow-lg transition-transform duration-300 ease-in-out hover:scale-105 ${gradient}`}>
20
  {(status === 'New' || status === 'Coming Soon') && (
21
+ <div className={`absolute top-2 right-2 ${bg} ${text} text-xs font-bold py-1 px-2 rounded-full`}>
22
+ {status}
23
  </div>
24
  )}
25
  <div className="flex items-center mb-3">
 
31
  <div className="mb-3 flex-grow">
32
  <Graphic />
33
  </div>
34
+ <p className="text-sm font-medium mb-3 leading-tight">{description}</p>
35
  <button
36
  className={`w-full bg-white ${text} py-2 px-3 rounded-lg text-sm font-semibold transition-colors mt-auto ${
37
  isComingSoon ? 'opacity-50 cursor-not-allowed' : 'hover:bg-opacity-90'
components/CategoryRow.tsx CHANGED
@@ -12,8 +12,9 @@ export default function CategoryRow({ categories }: CategoryRowProps) {
12
  {categories.map((category, index) => (
13
  <motion.div
14
  key={category.title}
 
 
15
  initial={{ opacity: 0, y: 20 }}
16
- animate={{ opacity: 1, y: 0 }}
17
  transition={{ duration: 0.5, delay: index * 0.1 }}
18
  >
19
  <CategoryCard {...category} />
@@ -21,4 +22,4 @@ export default function CategoryRow({ categories }: CategoryRowProps) {
21
  ))}
22
  </div>
23
  );
24
- }
 
12
  {categories.map((category, index) => (
13
  <motion.div
14
  key={category.title}
15
+ whileInView={{ opacity: 1, y: 0 }}
16
+ viewport={{ once: false }}
17
  initial={{ opacity: 0, y: 20 }}
 
18
  transition={{ duration: 0.5, delay: index * 0.1 }}
19
  >
20
  <CategoryCard {...category} />
 
22
  ))}
23
  </div>
24
  );
25
+ }
components/ui/command.tsx DELETED
@@ -1,155 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { type DialogProps } from "@radix-ui/react-dialog"
5
- import { MagnifyingGlassIcon } from "@radix-ui/react-icons"
6
- import { Command as CommandPrimitive } from "cmdk"
7
-
8
- import { cn } from "@/lib/utils"
9
- import { Dialog, DialogContent } from "@/components/ui/dialog"
10
-
11
- const Command = React.forwardRef<
12
- React.ElementRef<typeof CommandPrimitive>,
13
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
- >(({ className, ...props }, ref) => (
15
- <CommandPrimitive
16
- ref={ref}
17
- className={cn(
18
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
- className
20
- )}
21
- {...props}
22
- />
23
- ))
24
- Command.displayName = CommandPrimitive.displayName
25
-
26
- interface CommandDialogProps extends DialogProps {}
27
-
28
- const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
29
- return (
30
- <Dialog {...props}>
31
- <DialogContent className="overflow-hidden p-0">
32
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
33
- {children}
34
- </Command>
35
- </DialogContent>
36
- </Dialog>
37
- )
38
- }
39
-
40
- const CommandInput = React.forwardRef<
41
- React.ElementRef<typeof CommandPrimitive.Input>,
42
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
43
- >(({ className, ...props }, ref) => (
44
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
45
- <MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
46
- <CommandPrimitive.Input
47
- ref={ref}
48
- className={cn(
49
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
50
- className
51
- )}
52
- {...props}
53
- />
54
- </div>
55
- ))
56
-
57
- CommandInput.displayName = CommandPrimitive.Input.displayName
58
-
59
- const CommandList = React.forwardRef<
60
- React.ElementRef<typeof CommandPrimitive.List>,
61
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
62
- >(({ className, ...props }, ref) => (
63
- <CommandPrimitive.List
64
- ref={ref}
65
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
66
- {...props}
67
- />
68
- ))
69
-
70
- CommandList.displayName = CommandPrimitive.List.displayName
71
-
72
- const CommandEmpty = React.forwardRef<
73
- React.ElementRef<typeof CommandPrimitive.Empty>,
74
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
75
- >((props, ref) => (
76
- <CommandPrimitive.Empty
77
- ref={ref}
78
- className="py-6 text-center text-sm"
79
- {...props}
80
- />
81
- ))
82
-
83
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName
84
-
85
- const CommandGroup = React.forwardRef<
86
- React.ElementRef<typeof CommandPrimitive.Group>,
87
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
88
- >(({ className, ...props }, ref) => (
89
- <CommandPrimitive.Group
90
- ref={ref}
91
- className={cn(
92
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
93
- className
94
- )}
95
- {...props}
96
- />
97
- ))
98
-
99
- CommandGroup.displayName = CommandPrimitive.Group.displayName
100
-
101
- const CommandSeparator = React.forwardRef<
102
- React.ElementRef<typeof CommandPrimitive.Separator>,
103
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
104
- >(({ className, ...props }, ref) => (
105
- <CommandPrimitive.Separator
106
- ref={ref}
107
- className={cn("-mx-1 h-px bg-border", className)}
108
- {...props}
109
- />
110
- ))
111
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName
112
-
113
- const CommandItem = React.forwardRef<
114
- React.ElementRef<typeof CommandPrimitive.Item>,
115
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
116
- >(({ className, ...props }, ref) => (
117
- <CommandPrimitive.Item
118
- ref={ref}
119
- className={cn(
120
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
121
- className
122
- )}
123
- {...props}
124
- />
125
- ))
126
-
127
- CommandItem.displayName = CommandPrimitive.Item.displayName
128
-
129
- const CommandShortcut = ({
130
- className,
131
- ...props
132
- }: React.HTMLAttributes<HTMLSpanElement>) => {
133
- return (
134
- <span
135
- className={cn(
136
- "ml-auto text-xs tracking-widest text-muted-foreground",
137
- className
138
- )}
139
- {...props}
140
- />
141
- )
142
- }
143
- CommandShortcut.displayName = "CommandShortcut"
144
-
145
- export {
146
- Command,
147
- CommandDialog,
148
- CommandInput,
149
- CommandList,
150
- CommandEmpty,
151
- CommandGroup,
152
- CommandItem,
153
- CommandShortcut,
154
- CommandSeparator,
155
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/utils.ts CHANGED
@@ -16,25 +16,25 @@ export const colorConfigs: Record<string, ColorConfig> = {
16
  indigo: {
17
  bg: 'bg-indigo-200',
18
  text: 'text-indigo-800',
19
- gradient: 'from-indigo-500 to-indigo-700',
20
  iconBg: 'bg-indigo-200',
21
  },
22
  teal: {
23
  bg: 'bg-teal-200',
24
  text: 'text-teal-800',
25
- gradient: 'from-teal-500 to-teal-700',
26
  iconBg: 'bg-teal-200',
27
  },
28
  rose: {
29
  bg: 'bg-rose-200',
30
  text: 'text-rose-800',
31
- gradient: 'from-rose-500 to-rose-700',
32
  iconBg: 'bg-rose-200',
33
  },
34
  amber: {
35
  bg: 'bg-amber-200',
36
  text: 'text-amber-800',
37
- gradient: 'from-amber-500 to-amber-700',
38
  iconBg: 'bg-amber-200',
39
  },
40
  };
@@ -43,7 +43,7 @@ export const getColorConfig = (colorName: string): ColorConfig => {
43
  return colorConfigs[colorName] || {
44
  bg: 'bg-gray-200',
45
  text: 'text-gray-800',
46
- gradient: 'from-gray-500 to-gray-700',
47
  iconBg: 'bg-gray-200',
48
  };
49
  };
 
16
  indigo: {
17
  bg: 'bg-indigo-200',
18
  text: 'text-indigo-800',
19
+ gradient: 'bg-gradient-to-br from-indigo-500 to-indigo-700',
20
  iconBg: 'bg-indigo-200',
21
  },
22
  teal: {
23
  bg: 'bg-teal-200',
24
  text: 'text-teal-800',
25
+ gradient: 'bg-gradient-to-br from-teal-500 to-teal-700',
26
  iconBg: 'bg-teal-200',
27
  },
28
  rose: {
29
  bg: 'bg-rose-200',
30
  text: 'text-rose-800',
31
+ gradient: 'bg-gradient-to-br from-rose-500 to-rose-700',
32
  iconBg: 'bg-rose-200',
33
  },
34
  amber: {
35
  bg: 'bg-amber-200',
36
  text: 'text-amber-800',
37
+ gradient: 'bg-gradient-to-br from-amber-500 to-amber-700',
38
  iconBg: 'bg-amber-200',
39
  },
40
  };
 
43
  return colorConfigs[colorName] || {
44
  bg: 'bg-gray-200',
45
  text: 'text-gray-800',
46
+ gradient: 'bg-gradient-to-br from-gray-500 to-gray-700',
47
  iconBg: 'bg-gray-200',
48
  };
49
  };
next.config.mjs CHANGED
@@ -1,4 +1,7 @@
1
  /** @type {import('next').NextConfig} */
2
- const nextConfig = {};
 
 
 
3
 
4
  export default nextConfig;
 
1
  /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ output: 'export',
4
+ distDir: 'dist',
5
+ };
6
 
7
  export default nextConfig;
tailwind.config.ts CHANGED
@@ -6,6 +6,7 @@ const config: Config = {
6
  "./pages/**/*.{js,ts,jsx,tsx,mdx}",
7
  "./components/**/*.{js,ts,jsx,tsx,mdx}",
8
  "./app/**/*.{js,ts,jsx,tsx,mdx}",
 
9
  ],
10
  theme: {
11
  extend: {
 
6
  "./pages/**/*.{js,ts,jsx,tsx,mdx}",
7
  "./components/**/*.{js,ts,jsx,tsx,mdx}",
8
  "./app/**/*.{js,ts,jsx,tsx,mdx}",
9
+ "./lib/**/*.{js,ts,jsx,tsx,mdx}",
10
  ],
11
  theme: {
12
  extend: {
tsconfig.json CHANGED
@@ -1,6 +1,10 @@
1
  {
2
  "compilerOptions": {
3
- "lib": ["dom", "dom.iterable", "esnext"],
 
 
 
 
4
  "allowJs": true,
5
  "skipLibCheck": true,
6
  "strict": true,
@@ -18,9 +22,19 @@
18
  }
19
  ],
20
  "paths": {
21
- "@/*": ["./*"]
 
 
22
  }
23
  },
24
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
- "exclude": ["node_modules"]
 
 
 
 
 
 
 
 
26
  }
 
1
  {
2
  "compilerOptions": {
3
+ "lib": [
4
+ "dom",
5
+ "dom.iterable",
6
+ "esnext"
7
+ ],
8
  "allowJs": true,
9
  "skipLibCheck": true,
10
  "strict": true,
 
22
  }
23
  ],
24
  "paths": {
25
+ "@/*": [
26
+ "./*"
27
+ ]
28
  }
29
  },
30
+ "include": [
31
+ "next-env.d.ts",
32
+ "**/*.ts",
33
+ "**/*.tsx",
34
+ ".next/types/**/*.ts",
35
+ "dist/types/**/*.ts"
36
+ ],
37
+ "exclude": [
38
+ "node_modules"
39
+ ]
40
  }