From 2cc7ec1b70844746b305affc7ef090a2d6dcdd0c Mon Sep 17 00:00:00 2001 From: Mishig Davaadorj Date: Mon, 30 Oct 2023 12:23:26 +0100 Subject: [PATCH] Revert "Don't call api inference if output exists" This reverts commit 7cfc6cd525b1f726e7394a95947f96b42d1082b3. --- .../AudioClassificationWidget.svelte | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/js/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte b/js/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte index 427dce8bb0..3b2b19a2af 100644 --- a/js/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte +++ b/js/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte @@ -61,20 +61,7 @@ } } - interface GetOutputOptions { - withModelLoading?: boolean; - isOnLoadCall?: boolean; - sampleOutput?: WidgetExampleOutputLabels; - } - - async function getOutput({ withModelLoading = false, isOnLoadCall = false, sampleOutput = undefined }: GetOutputOptions = {}) { - // don't call api-inference if sample output already exists - if(isValidOutputLabels(sampleOutput)) { - output = sampleOutput; - outputJson = ""; - return; - } - + async function getOutput({ withModelLoading = false, isOnLoadCall = false } = {}) { if (!file && !selectedSampleUrl) { error = "You must select or record an audio file"; output = []; @@ -140,7 +127,7 @@ filename = sample.example_title!; fileUrl = sample.src; selectedSampleUrl = sample.src; - getOutput({sampleOutput: sample.output}); + getOutput(); } function previewInputSample(sample: WidgetExampleAssetInput) { @@ -160,12 +147,12 @@ } onMount(() => { - const [exampleTitle, src, output] = getDemoInputs(model, ["example_title", "src", "output"]); + const [exampleTitle, src] = getDemoInputs(model, ["example_title", "src"]); if (callApiOnMount && src) { filename = exampleTitle ?? ""; fileUrl = src; selectedSampleUrl = src; - getOutput({ isOnLoadCall: true, sampleOutput: output }); + getOutput({ isOnLoadCall: true }); } });