Models Window
Get labels from WhisperSeg API
const callWhisperSeg = async (event) => {
event.preventDefault()
passWhisperSegIsLoadingToTrack(true)
const path = import.meta.env.VITE_BACKEND_SERVICE_ADDRESS+'get-labels'
const annotatedAreas = filterAndConvertAnnotatedAreasForWhisper()
const convertedLabels = filterAndConvertLabelsForWhisper()
const requestParameters = {
audio_id: audioId,
annotated_areas: annotatedAreas,
human_labels: convertedLabels,
model_name: selectedInferenceModel,
min_frequency: minFreqInference,
token: tokenInference
}
try {
const response = await axios.post(path, requestParameters)
const whisperObjects = response.data.labels
// Create new species, Individuals and Clusternames in the Species panel from the whisper labels
const updatedSpeciesArray = createSpeciesFromImportedLabels(whisperObjects, speciesArray)
passSpeciesArrayToApp(updatedSpeciesArray)
// Assign Species Information to the new labels
const whisperLabels = assignSpeciesInformationToImportedLabels(updatedSpeciesArray, whisperObjects)
const annotatedAreaLabels = labels.filter( label => label.species === ANNOTATED_AREA)
const combinedLabels = whisperLabels.concat(annotatedAreaLabels)
passLabelsToTrack(combinedLabels)
passShowModelsWindowToWhisperSeg(false)
} catch (error){
if (error.response.status === 403){
toast.error('Access to WhisperSeg denied due to incorrect access token.')
} else {
toast.error('Something went wrong with your request. Check the console to view the error.')
console.error(error)
}
} finally {
passWhisperSegIsLoadingToTrack(false)
}
}Train a custom model
Last updated