Skip to content

Commit e36d73a

Browse files
author
thorwebdev
committed
feat: add PGlite Semantic Search example.
1 parent 047636c commit e36d73a

16 files changed

+6880
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ A collection of [🤗 Transformers.js](https://huggingface.co/docs/transformers.
55
| Name | Description | Links |
66
| ----------------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------- |
77
| [Segment Anything WebGPU](./segment-anything-webgpu/) | In-browser image segmentation | [Demo](https://huggingface.co/spaces/webml-community/segment-anything-webgpu) |
8+
| [PGlite Semantic Search](./pglite-semantic-search/) | In-browser semantic search | [Demo](https://huggingface.co/spaces/thorwebdev/pglite-semantic-search) |
89

910
Check out the Transformers.js [template](https://huggingface.co/new-space?template=static-templates%2Ftransformers.js) on Hugging Face to get started in one click!

pglite-semantic-search/.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

pglite-semantic-search/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: PGlite Semantic Search
3+
emoji: 🔎
4+
colorFrom: blue
5+
colorTo: yellow
6+
sdk: static
7+
pinned: false
8+
models:
9+
- Supabase/gte-small
10+
license: mit
11+
short_description: In-browser Semantic Search
12+
---
13+
14+
# In-Browser Semantic Search with Transformers.js and PGlite + pgvector
15+
16+
100% in-browser Semantic Search with [Transformers.js](https://huggingface.co/docs/transformers.js), [PGlite](https://github.com/electric-sql/pglite) + [pgvector](https://github.com/pgvector/pgvector)!
17+
18+
19+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{
9+
files: ['**/*.{js,jsx}'],
10+
ignores: ['dist'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
parserOptions: {
15+
ecmaVersion: 'latest',
16+
ecmaFeatures: { jsx: true },
17+
sourceType: 'module',
18+
},
19+
},
20+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

pglite-semantic-search/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Browser Vector Search</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)