Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(blog): wrap code to fit without horizontal scroll

Greg Richardson0d705eb11efe
diff --git a/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx b/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx
index eb801f55fa1..2365829d325 100644
--- a/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx
+++ b/apps/www/_blog/2023-08-07-hugging-face-supabase.mdx
@@ -90,6 +90,7 @@ AI/ML is primarily the domain of the Python community, but thanks to some amazin
Let’s step through a small demo where we accept some text, convert it into an embedding, and then store it in our Postgres database. You can create a new function with supabase functions new embed and fill it with the following code snippet:
+{/* prettier-ignore */}
```ts
import { serve } from 'https://deno.land/[email protected]/http/server.ts'
import { env, pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]'
@@ -99,10 +100,16 @@ import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
env.useBrowserCache = false
env.allowLocalModels = false
-const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
+const supabase = createClient(
+ 'https://xyzcompany.supabase.co',
+ 'public-anon-key',
+)
// Construct pipeline outside of serve for faster warm starts
-const pipe = await pipeline('feature-extraction', 'Supabase/gte-small')
+const pipe = await pipeline(
+ 'feature-extraction',
+ 'Supabase/gte-small',
+)
// Deno Handler
serve(async (req) => {
@@ -118,10 +125,15 @@ serve(async (req) => {
const embedding = Array.from(output.data)
// Store the embedding
- const { data, error } = await supabase.from('collections').insert({ embedding })
+ const { data, error } = await supabase
+ .from('collections')
+ .insert({ embedding })
// Return the embedding
- return new Response({ new_row: data }, { headers: { 'Content-Type': 'application/json' } })
+ return new Response(
+ { new_row: data },
+ { headers: { 'Content-Type': 'application/json' } },
+ )
})
```