scrimba
AI Engineering
Open-source AI Models
Text To Speech With HuggingFace.js Inference 🤗
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

To see this lesson you need to be logged in. Joining Scrimba is free and gives you access to 20+ courses.Sign up
Text To Speech With HuggingFace.js Inference 🤗
AboutCommentsNotes
Text To Speech With HuggingFace.js Inference 🤗
Expand for more info
index.js
run
preview
console
import { HfInference } from '@huggingface/inference'

// Create your Hugging Face Token: https://huggingface.co/settings/tokens
// Set your Hugging Face Token: https://scrimba.com/dashboard#env
// Learn more: https://scrimba.com/links/env-variables
const hf = new HfInference(process.env.HF_TOKEN)

// Hugging Face Inference API docs: https://huggingface.co/docs/huggingface.js/inference/README

const text = "It's an exciting time to be an A.I. engineer."
Console
/index.html
-3:18