File size: 1,593 Bytes
b2ecf7d
 
 
 
 
 
 
 
388ac76
 
 
 
 
 
 
b2ecf7d
 
 
790ed2e
 
 
 
 
 
 
 
b2ecf7d
 
16601c5
388ac76
 
 
 
 
 
 
b2ecf7d
388ac76
790ed2e
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Huggingface Widgets

Open-source version of the inference widgets from huggingface.co

> Built with Svelte and SvelteKit

**Demo page:** https://huggingface.co/spaces/huggingfacejs/inference-widgets

## Publishing

Because `@huggingface/widgets` depends on `@huggingface/tasks`, you need to publish `@huggingface/tasks` first, and then `@huggingface/widgets`. There should be a CI check to prevent publishing `@huggingface/widgets` if `@huggingface/tasks` hasn't been published yet.

## Demo

You can run the demo locally:

```console
pnpm install
pnpm dev --open
```

If you are submitting a PR, make sure that you run `format` & `lint` before submitting the PR:

```console
pnpm format
pnpm lint
```

If you want to try the "Sign-in with HF" feature locally, you will need to https://huggingface.co/settings/applications/new an OAuth application with `"openid"`, `"profile"` and `"inference-api"` scopes and `http://localhost:5173/auth/callback/huggingface` as the redirect URL.

Then you can create a `.env.local` file with the following content:

```env
OAUTH_CLIENT_ID=...
OAUTH_CLIENT_SECRET=...
```

If you want to try the "Sign-in with HF" feature in a Space, you can just duplicate https://huggingface.co/spaces/huggingfacejs/inference-widgets, it should work out of the box thanks to the metadata in the `README.md` file.

## Testing for moon (for huggingface admins)

```console
pnpm i
pnpm build
```

And then inside moon, run the following command for both `server` & `front`:

```console
npm i --save @huggingface/widgets@<relative path to huggingface.js/packages/widgets>
```