Skip to content

Commit 982498c

Browse files
authored
Create in-browser version of semantic-image-search example app (#326)
* Create in-browser version of `semantic-image-search` * Add loading model and database message * Create README.md * Add link to example app
1 parent c367f9d commit 982498c

22 files changed

+5460
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ Want to jump straight in? Get started with one of our sample applications/templa
112112
| Whisper Web | Speech recognition w/ Whisper | [link](https://github.com/xenova/whisper-web) |
113113
| Doodle Dash | Real-time sketch-recognition game (see [blog](https://huggingface.co/blog/ml-web-games)) | [link](https://github.com/xenova/doodle-dash) |
114114
| Code Playground | In-browser code completion website | [link](./examples/code-completion/) |
115-
| Semantic Image Search | Search for images with text (Next.js + Supabase) | [link](./examples/semantic-image-search/) |
115+
| Semantic Image Search (client-side) | Search for images with text | [link](./examples/semantic-image-search-client/) |
116+
| Semantic Image Search (server-side) | Search for images with text (Supabase) | [link](./examples/semantic-image-search/) |
116117
| Vanilla JavaScript | In-browser object detection | [link](./examples/vanilla-js/) |
117118
| React | Multilingual translation website | [link](./examples/react-translator/) |
118119
| Browser extension | Text classification extension | [link](./examples/extension/) |

docs/snippets/3_examples.snippet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Want to jump straight in? Get started with one of our sample applications/templa
55
| Whisper Web | Speech recognition w/ Whisper | [link](https://github.com/xenova/whisper-web) |
66
| Doodle Dash | Real-time sketch-recognition game (see [blog](https://huggingface.co/blog/ml-web-games)) | [link](https://github.com/xenova/doodle-dash) |
77
| Code Playground | In-browser code completion website | [link](./examples/code-completion/) |
8-
| Semantic Image Search | Search for images with text (Next.js + Supabase) | [link](./examples/semantic-image-search/) |
8+
| Semantic Image Search (client-side) | Search for images with text | [link](./examples/semantic-image-search-client/) |
9+
| Semantic Image Search (server-side) | Search for images with text (Supabase) | [link](./examples/semantic-image-search/) |
910
| Vanilla JavaScript | In-browser object detection | [link](./examples/vanilla-js/) |
1011
| React | Multilingual translation website | [link](./examples/react-translator/) |
1112
| Browser extension | Text classification extension | [link](./examples/extension/) |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
```
14+
15+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16+
17+
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
18+
19+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
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.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
}
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
// (Optional) Export as a static site
4+
// See https://nextjs.org/docs/pages/building-your-application/deploying/static-exports#configuration
5+
output: 'export', // Feel free to modify/remove this option
6+
7+
// Override the default webpack configuration
8+
webpack: (config) => {
9+
// Ignore node-specific modules when bundling for the browser
10+
// See https://webpack.js.org/configuration/resolve/#resolvealias
11+
config.resolve.alias = {
12+
...config.resolve.alias,
13+
'sharp$': false,
14+
'onnxruntime-node$': false,
15+
}
16+
return config;
17+
},
18+
};
19+
20+
module.exports = nextConfig;

0 commit comments

Comments
 (0)