// frontend/src/api/client.js const API = "http://localhost:3001/api"; export async function getModels() { const res = await fetch(`${API}/models`); return res.json(); } export async function uploadAudio(file) { const fd = new FormData(); fd.append("audio", file); const res = await fetch(`${API}/audio/upload`, { method: "POST", body: fd }); if (!res.ok) { const txt = await res.text(); throw new Error(txt || "Upload failed"); } return res.json(); } export async function createJob(payload) { const res = await fetch(`${API}/create`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); return res.json(); } export async function getJobStatus(jobId) { const res = await fetch(`${API}/create/${jobId}/status`); return res.json(); } export async function listAudio() { const res = await fetch(`${API}/audio`); return res.json(); }