My Broadway6 Lab

// pages/index.tsx import { useState } from ‘react’; export default function Home() { const [text, setText] = useState(”); const [loading, setLoading] = useState(false); const handleGenerate = async () => { setLoading(true); const res = await fetch(‘/api/tts’, { method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify({ text }) }); const blob = await res.blob(); const url = window.URL.createObjectURL(blob); const a = document.createElement(‘a’); a.href = url; a.download = ‘voice.mp3’; a.click(); setLoading(false); }; return (

Text to Voice Generator