Commit
Β·
f3219d4
1
Parent(s):
bf3b742
add contribution guide
Browse files- .github/workflows/deploy.yml +6 -0
- README.md +47 -0
- components/Footer.tsx +9 -10
.github/workflows/deploy.yml
CHANGED
|
@@ -13,6 +13,8 @@ jobs:
|
|
| 13 |
steps:
|
| 14 |
- name: Checkout repository
|
| 15 |
uses: actions/checkout@v3
|
|
|
|
|
|
|
| 16 |
|
| 17 |
- name: Set up Git
|
| 18 |
run: |
|
|
@@ -23,6 +25,10 @@ jobs:
|
|
| 23 |
run: |
|
| 24 |
git remote add hf https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ secrets.HF_USERNAME }}/${{ secrets.SPACE_NAME }}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
- name: Commit changes if any
|
| 27 |
run: |
|
| 28 |
git add .
|
|
|
|
| 13 |
steps:
|
| 14 |
- name: Checkout repository
|
| 15 |
uses: actions/checkout@v3
|
| 16 |
+
with:
|
| 17 |
+
fetch-depth: 0 # Fetch all history for all branches and tags
|
| 18 |
|
| 19 |
- name: Set up Git
|
| 20 |
run: |
|
|
|
|
| 25 |
run: |
|
| 26 |
git remote add hf https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ secrets.HF_USERNAME }}/${{ secrets.SPACE_NAME }}
|
| 27 |
|
| 28 |
+
- name: Fetch from Hugging Face
|
| 29 |
+
run: |
|
| 30 |
+
git fetch hf
|
| 31 |
+
|
| 32 |
- name: Commit changes if any
|
| 33 |
run: |
|
| 34 |
git add .
|
README.md
CHANGED
|
@@ -9,8 +9,55 @@ app_port: 3000
|
|
| 9 |
---
|
| 10 |
# Transformers.js Playground
|
| 11 |
|
|
|
|
| 12 |

|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
## Getting Started
|
| 15 |
|
| 16 |
First, run the development server:
|
|
|
|
| 9 |
---
|
| 10 |
# Transformers.js Playground
|
| 11 |
|
| 12 |
+
|
| 13 |

|
| 14 |
|
| 15 |
+
## Contributing
|
| 16 |
+
|
| 17 |
+
Adding a demo is pretty straightforward. You can take a look at this [PR](https://github.com/cfahlgren1/transformersjs-playground/pull/1) as an example.
|
| 18 |
+
|
| 19 |
+
## Example of Adding Page to Playground
|
| 20 |
+
|
| 21 |
+
### Steps
|
| 22 |
+
|
| 23 |
+
#### 1. Add Route
|
| 24 |
+
Add the page where the demo will go under the category it belongs in. You can create hooks, components, and types as needed.
|
| 25 |
+
|
| 26 |
+
**Example**
|
| 27 |
+
```
|
| 28 |
+
app
|
| 29 |
+
βββ category
|
| 30 |
+
βββ [slug]
|
| 31 |
+
βββ generate-text
|
| 32 |
+
βββ llama-3.2
|
| 33 |
+
βββ page.tsx
|
| 34 |
+
```
|
| 35 |
+
<img width="1683" alt="image" src="https://github.com/user-attachments/assets/1903e56a-5ecd-4587-a382-579cfcc72763">
|
| 36 |
+
|
| 37 |
+
#### 2. Add demo to `categories.tsx`, this will allow it to show up on Categories Page
|
| 38 |
+
<img width="1657" alt="image" src="https://github.com/user-attachments/assets/1f1680af-9d9b-45b2-84a5-658b750fe020">
|
| 39 |
+
|
| 40 |
+
```ts
|
| 41 |
+
{
|
| 42 |
+
title: "Generate Text",
|
| 43 |
+
slug: "generate-text",
|
| 44 |
+
icon: Type,
|
| 45 |
+
description: "Llama. Qwen. Enough said.",
|
| 46 |
+
status: "Available",
|
| 47 |
+
colorName: "blue",
|
| 48 |
+
graphic: TextGenerationIcon,
|
| 49 |
+
demos: [
|
| 50 |
+
{
|
| 51 |
+
title: "Llama 3.2",
|
| 52 |
+
slug: "llama-3.2",
|
| 53 |
+
component: Llama32Page,
|
| 54 |
+
description: "Llama 3.2 in the browser. WebGPU FTW."
|
| 55 |
+
}
|
| 56 |
+
]
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
|
| 61 |
## Getting Started
|
| 62 |
|
| 63 |
First, run the development server:
|
components/Footer.tsx
CHANGED
|
@@ -6,17 +6,16 @@ const Footer: React.FC = () => {
|
|
| 6 |
return (
|
| 7 |
<footer className="bg-emerald-400/80 p-20 relative overflow-hidden rounded-xl">
|
| 8 |
<div className="max-w-7xl mx-auto relative z-10">
|
| 9 |
-
<div className="
|
| 10 |
{categories.map((category) => (
|
| 11 |
-
<
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</div>
|
| 20 |
))}
|
| 21 |
</div>
|
| 22 |
</div>
|
|
|
|
| 6 |
return (
|
| 7 |
<footer className="bg-emerald-400/80 p-20 relative overflow-hidden rounded-xl">
|
| 8 |
<div className="max-w-7xl mx-auto relative z-10">
|
| 9 |
+
<div className="flex flex-wrap justify-between items-center gap-y-4 mb-12">
|
| 10 |
{categories.map((category) => (
|
| 11 |
+
<Link
|
| 12 |
+
key={category.slug}
|
| 13 |
+
href={`/category/${category.slug}`}
|
| 14 |
+
className="text-lg font-bold text-emerald-800 hover:text-emerald-900 transition-colors duration-300 ease-in-out relative group"
|
| 15 |
+
>
|
| 16 |
+
{category.title}
|
| 17 |
+
<span className="absolute left-0 right-0 bottom-0 h-0.5 bg-emerald-800 transform scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out"></span>
|
| 18 |
+
</Link>
|
|
|
|
| 19 |
))}
|
| 20 |
</div>
|
| 21 |
</div>
|