diff --git a/src/components/models/code/MelottsCode.astro b/src/components/models/code/MelottsCode.astro new file mode 100644 index 000000000000000..de32484a6f8ba95 --- /dev/null +++ b/src/components/models/code/MelottsCode.astro @@ -0,0 +1,33 @@ +--- +import { z } from "astro:schema"; +import { Code } from "@astrojs/starlight/components"; +import Details from "~/components/Details.astro"; + +type Props = z.infer; + +const props = z.object({ + name: z.string(), +}); + +const { name } = props.parse(Astro.props); + +const worker = ` +export interface Env { + AI: Ai; +} + +export default { + async fetch(request, env): Promise { + const { audio } = await env.AI.run('${name}', { + prompt: 'Hello world', + lang: 'en', + }); + // Returns the base64 encoded MP3 audio + return Response.json({ audio }); + }, +} satisfies ExportedHandler;`; +--- + +
+ +
\ No newline at end of file diff --git a/src/pages/workers-ai/models/[name].astro b/src/pages/workers-ai/models/[name].astro index afea341fb6b1263..f37151f8e672bd9 100644 --- a/src/pages/workers-ai/models/[name].astro +++ b/src/pages/workers-ai/models/[name].astro @@ -23,6 +23,7 @@ import StableDiffusionV15Img2ImgCode from "~/components/models/code/StableDiffus import StableDiffusionV15InpaintingCode from "~/components/models/code/StableDiffusion-v1-5-inpaintingCode.astro"; import Flux1Schnell from "~/components/models/code/Flux-1-Schnell.astro"; import WhisperBase64Code from "~/components/models/code/WhisperBase64Code.astro"; +import MelottsCode from "~/components/models/code/MelottsCode.astro"; import LlamaGuard from "~/components/models/code/LlamaGuard.astro"; import BgeRerankerBase from "~/components/models/code/Bge-Reranker-Base.astro"; @@ -95,6 +96,10 @@ if (model.name === "@cf/openai/whisper-large-v3-turbo") { CodeExamples = WhisperBase64Code; } +if (model.name === "@cf/myshell-ai/melotts") { + CodeExamples = MelottsCode; +} + if (model.name === "@cf/meta/llama-guard-3-8b") { CodeExamples = LlamaGuard; } @@ -251,4 +256,4 @@ const starlightPageProps = { - + \ No newline at end of file