UNPKG

@p0llen/speaker-detector-client

Version:

React client for interfacing with the [speaker-detector](https://pypi.org/project/speaker-detector) Python backend. Supports real-time speaker identification, meeting transcription, and speaker enrollment.

121 lines (119 loc) 3.75 kB
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; // Unified API methods for speaker detector backend export function enrollSpeaker(_x, _x2) { return _enrollSpeaker.apply(this, arguments); } function _enrollSpeaker() { _enrollSpeaker = _asyncToGenerator(function* (blob, speakerName) { var form = new FormData(); form.append("file", blob, "enroll.webm"); form.append("speaker", speakerName); var res = yield fetch("/api/enroll", { method: "POST", body: form }); return res.json(); }); return _enrollSpeaker.apply(this, arguments); } export function identifySpeaker(_x3) { return _identifySpeaker.apply(this, arguments); } function _identifySpeaker() { _identifySpeaker = _asyncToGenerator(function* (blob) { var form = new FormData(); form.append("file", blob, "identify.webm"); var res = yield fetch("/api/identify", { method: "POST", body: form }); return res.json(); }); return _identifySpeaker.apply(this, arguments); } export function fetchSpeakers() { return _fetchSpeakers.apply(this, arguments); } function _fetchSpeakers() { _fetchSpeakers = _asyncToGenerator(function* () { var res = yield fetch("/api/speakers"); return res.json(); }); return _fetchSpeakers.apply(this, arguments); } export function startMeeting() { return _startMeeting.apply(this, arguments); } function _startMeeting() { _startMeeting = _asyncToGenerator(function* () { return fetch("/api/meetings/start", { method: "POST" }); }); return _startMeeting.apply(this, arguments); } export function stopMeeting() { return _stopMeeting.apply(this, arguments); } function _stopMeeting() { _stopMeeting = _asyncToGenerator(function* () { return fetch("/api/meetings/stop", { method: "POST" }); }); return _stopMeeting.apply(this, arguments); } export function generateTranscript() { return _generateTranscript.apply(this, arguments); } /* --- Rebuild helpers ----------------------------------- */ function _generateTranscript() { _generateTranscript = _asyncToGenerator(function* () { var res = yield fetch("/api/meetings/transcribe"); return res.json(); }); return _generateTranscript.apply(this, arguments); } export function fetchRebuildList() { return _fetchRebuildList.apply(this, arguments); } function _fetchRebuildList() { _fetchRebuildList = _asyncToGenerator(function* () { var res = yield fetch("/api/rebuild-list"); return res.json(); // -> { toRebuild: [...] } }); return _fetchRebuildList.apply(this, arguments); } export function rebuildSpeaker(_x4) { return _rebuildSpeaker.apply(this, arguments); } function _rebuildSpeaker() { _rebuildSpeaker = _asyncToGenerator(function* (speakerId) { return fetch("/api/rebuild/".concat(speakerId), { method: "POST" }).then(r => r.json()); // -> { status: "rebuilt", name: ... } }); return _rebuildSpeaker.apply(this, arguments); } export function rebuildAllSpeakers() { return _rebuildAllSpeakers.apply(this, arguments); } function _rebuildAllSpeakers() { _rebuildAllSpeakers = _asyncToGenerator(function* () { return fetch("/api/rebuild-all", { method: "POST" }).then(r => r.json()); // -> { status: "rebuilt", rebuilt: [...] } }); return _rebuildAllSpeakers.apply(this, arguments); } export function rebuildBackgroundNoise() { return _rebuildBackgroundNoise.apply(this, arguments); } function _rebuildBackgroundNoise() { _rebuildBackgroundNoise = _asyncToGenerator(function* () { return fetch("/api/rebuild-background", { method: "POST" }).then(r => r.json()); // -> { status: "rebuilt" } }); return _rebuildBackgroundNoise.apply(this, arguments); }