Download frontend/src/api/client.js from virtual-miku/miku-voice: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/virtual-miku/miku-voice/resolve/main/frontend/src/api/client.js
- Command line
-
hf download hf://virtual-miku/miku-voice/frontend/src/api/client.js
-
curl -L -o client.js https://huggingface.co/virtual-miku/miku-voice/resolve/main/frontend/src/api/client.js
1.01 kB
| // 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(); | |
| } |