The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs(ai): initial hugging face third party guide draft
Greg Richardson4bf8c2e7d864
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.tsindex e3a559fe3cc..bc685d0f244 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts@@ -907,6 +907,10 @@ export const ai: NavMenuConstant = {name: 'LangChain',url: '/guides/ai/langchain',},+ {+ name: 'Hugging Face',+ url: '/guides/ai/hugging-face',+ },],},],diff --git a/apps/docs/pages/guides/ai/hugging-face.mdx b/apps/docs/pages/guides/ai/hugging-face.mdxnew file mode 100644index 00000000000..16819842e6a--- /dev/null+++ b/apps/docs/pages/guides/ai/hugging-face.mdx@@ -0,0 +1,98 @@+import Layout from '~/layouts/DefaultGuideLayout'++export const meta = {+ id: 'ai-hugging-face',+ title: 'Hugging Face',+ description: 'Learn how to integrate hugging face models with Supabase',+ sidebar_label: 'Hugging Face',+}++[Hugging Face](https://huggingface.co) is an open source hub for AI/ML models and tools. With over 100,000 machine learning models available, Hugging Face provides a great way to integrate specialized AI & ML tasks into your application.++## AI Tasks++Below are some of the types of tasks you can perform with Hugging Face:++### Natural language++- [Summarization](https://huggingface.co/tasks/summarization)+- [Text classification](https://huggingface.co/tasks/text-classification)+- [Text generation](https://huggingface.co/tasks/text-generation)+- [Translation](https://huggingface.co/tasks/translation)+- [Fill in the blank](https://huggingface.co/tasks/fill-mask)++### Computer Vision++- [Image to text](https://huggingface.co/tasks/image-to-text)+- [Text to image](https://huggingface.co/tasks/text-to-image)+- [Image classification](https://huggingface.co/tasks/image-classification)+- [Video classification](https://huggingface.co/tasks/video-classification)+- [Object detection](https://huggingface.co/tasks/object-detection)+- [Image segmentation](https://huggingface.co/tasks/image-segmentation)++### Audio++- [Text to speech](https://huggingface.co/tasks/text-to-speech)+- [Speech to text](https://huggingface.co/tasks/automatic-speech-recognition)+- [Audio classification](https://huggingface.co/tasks/audio-classification)++See a [full list of tasks](https://huggingface.co/tasks).++## Access token++You should first generate a Hugging Face access token for your app:++https://huggingface.co/settings/tokens++Name your token based on the app its being used for and the environment. For example, if you are building an image generation app you might create 2 tokens:++- "My Image Generator (Dev)"+- "My Image Generator (Prod)"++Since we will be using this token for the inference API, choose the `read` role.++<Admonition type="info">++Though it is possible to use the Hugging Face inference API today without an access token, [you may be rate limited](https://huggingface.co/docs/huggingface.js/inference/README#usage).++To ensure you don't experience any unexpected downtime or errors, we recommend creating an access token.++</Admonition>++## Integrate with Supabase++Supabase aims to provide all the necessary components to make it easy to integrate with third-party tools like Hugging Face. The way you integrate Hugging Face models into your Supabase project depends on the type of task you are using. Below are some common scenarios you will likely encounter:++### Web or Mobile app++When building a web or mobile app, you should never trust the client with secrets or credentials. This means you should never use your Hugging Face access token directly from your frontend. Supabase solves this using [Edge Functions](/docs/guides/functions), server side TypeScript functions that spin up on-demand only as you need them. Since Edge Functions run on a server, you can safely give them access to your Hugging Face access token.++<Admonition type="info">++You will need the `supabase` CLI [installed](/docs/guides/cli) for the following commands to work.++</Admonition>++To create a new edge function, navigate to your local project and initialize Supabase if you haven't already:++```shell+supabase init+```++Then create an edge function:++```shell+supabase functions new image-to-text+```++WIP...++## Resources++- Official [Langchain site](https://langchain.com/).+- Official [Langchain docs](https://js.langchain.com/docs/modules/indexes/vector_stores/integrations/supabase).+- Supabase [Hybrid Search](https://js.langchain.com/docs/modules/indexes/retrievers/supabase-hybrid).++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Page