import { useState } from "react"; export default function Translator() { const [text, setText] = useState(""); const [translation, setTranslation] = useState(""); const [loading, setLoading] = useState(false); const translateText = async () => { if (!text) return; setLoading(true); const response = await fetch( "https://api-inference.huggingface.co/models/Helsinki-NLP/opus-mt-en-uk", { method: "POST", headers: { "Authorization": `Bearer YOUR_HUGGINGFACE_API_KEY`, // Replace with your API key "Content-Type": "application/json", }, body: JSON.stringify({ inputs: text }), } ); const data = await response.json(); setTranslation(data[0]?.translation_text || "Translation failed."); setLoading(false); }; return (

English to Ukrainian Translator