Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
machineuser
commited on
Commit
•
d738fa8
1
Parent(s):
98e6fa9
Sync widgets demo
Browse files- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetAddSentenceBtn/WidgetAddSentenceBtn.svelte +1 -2
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetDropzone/WidgetDropzone.svelte +7 -6
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetFileInput/WidgetFileInput.svelte +3 -2
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetQuickInput/WidgetQuickInput.svelte +1 -2
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetRealtimeRecorder/WidgetRealtimeRecorder.svelte +20 -14
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetRecorder/WidgetRecorder.svelte +9 -10
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetSubmitBtn/WidgetSubmitBtn.svelte +2 -3
- packages/widgets/src/lib/components/InferenceWidget/shared/WidgetTableInput/WidgetTableInput.svelte +11 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte +8 -10
- packages/widgets/src/lib/components/InferenceWidget/widgets/AudioToAudioWidget/AudioToAudioWidget.svelte +8 -10
- packages/widgets/src/lib/components/InferenceWidget/widgets/AutomaticSpeechRecognitionWidget/AutomaticSpeechRecognitionWidget.svelte +11 -13
- packages/widgets/src/lib/components/InferenceWidget/widgets/ConversationalWidget/ConversationalWidget.svelte +1 -1
- packages/widgets/src/lib/components/InferenceWidget/widgets/FeatureExtractionWidget/FeatureExtractionWidget.svelte +1 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/FillMaskWidget/FillMaskWidget.svelte +1 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte +3 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/ImageSegmentationWidget/ImageSegmentationWidget.svelte +3 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/ImageToImageWidget/ImageToImageWidget.svelte +4 -10
- packages/widgets/src/lib/components/InferenceWidget/widgets/ImageToTextWidget/ImageToTextWidget.svelte +3 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/ObjectDetectionWidget/ObjectDetectionWidget.svelte +3 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/QuestionAnsweringWidget/QuestionAnsweringWidget.svelte +1 -3
- packages/widgets/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte +2 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/SummarizationWidget/SummarizationWidget.svelte +1 -7
- packages/widgets/src/lib/components/InferenceWidget/widgets/TableQuestionAnsweringWidget/TableQuestionAnsweringWidget.svelte +2 -4
- packages/widgets/src/lib/components/InferenceWidget/widgets/TabularDataWidget/TabularDataWidget.svelte +2 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte +1 -1
- packages/widgets/src/lib/components/InferenceWidget/widgets/TextToImageWidget/TextToImageWidget.svelte +1 -1
- packages/widgets/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte +1 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/TokenClassificationWidget/TokenClassificationWidget.svelte +1 -8
- packages/widgets/src/lib/components/InferenceWidget/widgets/VisualQuestionAnsweringWidget/VisualQuestionAnsweringWidget.svelte +4 -6
- packages/widgets/src/lib/components/InferenceWidget/widgets/ZeroShotClassificationWidget/ZeroShotClassificationWidget.svelte +1 -7
- packages/widgets/src/lib/components/InferenceWidget/widgets/ZeroShotImageClassificationWidget/ZeroShotImageClassificationWidget.svelte +4 -10
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetAddSentenceBtn/WidgetAddSentenceBtn.svelte
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
<script lang="ts">
|
2 |
export let isDisabled = false;
|
3 |
export let label = "Add Sentence";
|
4 |
-
export let onClick: (e: MouseEvent) => void;
|
5 |
</script>
|
6 |
|
7 |
{#if !isDisabled}
|
8 |
<!-- content here -->
|
9 |
-
<button class="btn-widget h-10 w-full px-5" disabled={isDisabled} on:click|preventDefault
|
10 |
{label}
|
11 |
</button>
|
12 |
{/if}
|
|
|
1 |
<script lang="ts">
|
2 |
export let isDisabled = false;
|
3 |
export let label = "Add Sentence";
|
|
|
4 |
</script>
|
5 |
|
6 |
{#if !isDisabled}
|
7 |
<!-- content here -->
|
8 |
+
<button class="btn-widget h-10 w-full px-5" disabled={isDisabled} on:click|preventDefault type="submit">
|
9 |
{label}
|
10 |
</button>
|
11 |
{/if}
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetDropzone/WidgetDropzone.svelte
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
import IconSpin from "../../../Icons/IconSpin.svelte";
|
4 |
import { getBlobFromUrl } from "../../shared/helpers.js";
|
5 |
import { isLoggedIn } from "../../stores.js";
|
|
|
6 |
|
7 |
export let accept = "image/*";
|
8 |
export let classNames = "";
|
@@ -10,8 +11,8 @@
|
|
10 |
export let isDisabled = false;
|
11 |
export let imgSrc = "";
|
12 |
export let label = "Drag image file here or click to browse from your device";
|
13 |
-
|
14 |
-
|
15 |
|
16 |
let fileInput: HTMLInputElement;
|
17 |
let isDragging = false;
|
@@ -20,7 +21,7 @@
|
|
20 |
function onChange() {
|
21 |
const file = fileInput.files?.[0];
|
22 |
if (file) {
|
23 |
-
|
24 |
}
|
25 |
}
|
26 |
|
@@ -43,14 +44,14 @@
|
|
43 |
const url = await new Promise<string>((resolve) => uriItem.getAsString((s) => resolve(s)));
|
44 |
const file = await getBlobFromUrl(url);
|
45 |
|
46 |
-
|
47 |
} else if (fileItem) {
|
48 |
const file = fileItem.getAsFile();
|
49 |
if (file) {
|
50 |
-
|
51 |
}
|
52 |
} else {
|
53 |
-
|
54 |
}
|
55 |
}
|
56 |
</script>
|
|
|
3 |
import IconSpin from "../../../Icons/IconSpin.svelte";
|
4 |
import { getBlobFromUrl } from "../../shared/helpers.js";
|
5 |
import { isLoggedIn } from "../../stores.js";
|
6 |
+
import { createEventDispatcher } from "svelte";
|
7 |
|
8 |
export let accept = "image/*";
|
9 |
export let classNames = "";
|
|
|
11 |
export let isDisabled = false;
|
12 |
export let imgSrc = "";
|
13 |
export let label = "Drag image file here or click to browse from your device";
|
14 |
+
|
15 |
+
const dispatch = createEventDispatcher<{ run: File | Blob; error: string }>();
|
16 |
|
17 |
let fileInput: HTMLInputElement;
|
18 |
let isDragging = false;
|
|
|
21 |
function onChange() {
|
22 |
const file = fileInput.files?.[0];
|
23 |
if (file) {
|
24 |
+
dispatch("run", file);
|
25 |
}
|
26 |
}
|
27 |
|
|
|
44 |
const url = await new Promise<string>((resolve) => uriItem.getAsString((s) => resolve(s)));
|
45 |
const file = await getBlobFromUrl(url);
|
46 |
|
47 |
+
dispatch("run", file);
|
48 |
} else if (fileItem) {
|
49 |
const file = fileItem.getAsFile();
|
50 |
if (file) {
|
51 |
+
dispatch("run", file);
|
52 |
}
|
53 |
} else {
|
54 |
+
dispatch("error", "Unrecognized dragged and dropped file or element.");
|
55 |
}
|
56 |
}
|
57 |
</script>
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetFileInput/WidgetFileInput.svelte
CHANGED
@@ -3,13 +3,14 @@
|
|
3 |
import IconFile from "../../../Icons/IconFile.svelte";
|
4 |
import { isLoggedIn } from "../../stores.js";
|
5 |
import LogInPopover from "../../../LogInPopover/LogInPopover.svelte";
|
|
|
6 |
|
7 |
export let accept: string | undefined;
|
8 |
export let classNames = "";
|
9 |
export let isLoading = false;
|
10 |
export let isDisabled = false;
|
11 |
export let label = "Browse for file";
|
12 |
-
|
13 |
|
14 |
let fileInput: HTMLInputElement;
|
15 |
let isDragging = false;
|
@@ -23,7 +24,7 @@
|
|
23 |
|
24 |
const file = fileInput.files?.[0];
|
25 |
if (file) {
|
26 |
-
|
27 |
}
|
28 |
}
|
29 |
</script>
|
|
|
3 |
import IconFile from "../../../Icons/IconFile.svelte";
|
4 |
import { isLoggedIn } from "../../stores.js";
|
5 |
import LogInPopover from "../../../LogInPopover/LogInPopover.svelte";
|
6 |
+
import { createEventDispatcher } from "svelte";
|
7 |
|
8 |
export let accept: string | undefined;
|
9 |
export let classNames = "";
|
10 |
export let isLoading = false;
|
11 |
export let isDisabled = false;
|
12 |
export let label = "Browse for file";
|
13 |
+
const dispatch = createEventDispatcher<{ run: File | Blob }>();
|
14 |
|
15 |
let fileInput: HTMLInputElement;
|
16 |
let isDragging = false;
|
|
|
24 |
|
25 |
const file = fileInput.files?.[0];
|
26 |
if (file) {
|
27 |
+
dispatch("run", file);
|
28 |
}
|
29 |
}
|
30 |
</script>
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetQuickInput/WidgetQuickInput.svelte
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
export let flatTop = false;
|
9 |
export let isLoading: boolean;
|
10 |
export let isDisabled = false;
|
11 |
-
export let onClickSubmitBtn: (e?: MouseEvent) => void;
|
12 |
export let placeholder = "Your sentence here...";
|
13 |
export let submitButtonLabel: string | undefined = undefined;
|
14 |
export let value: string = "";
|
@@ -42,8 +41,8 @@
|
|
42 |
{isLoading}
|
43 |
{isDisabled}
|
44 |
label={submitButtonLabel}
|
45 |
-
onClick={onClickSubmitBtn}
|
46 |
withParentLoginPopover={true}
|
|
|
47 |
on:logInPopover={() => (popOverOpen = true)}
|
48 |
/>
|
49 |
</div>
|
|
|
8 |
export let flatTop = false;
|
9 |
export let isLoading: boolean;
|
10 |
export let isDisabled = false;
|
|
|
11 |
export let placeholder = "Your sentence here...";
|
12 |
export let submitButtonLabel: string | undefined = undefined;
|
13 |
export let value: string = "";
|
|
|
41 |
{isLoading}
|
42 |
{isDisabled}
|
43 |
label={submitButtonLabel}
|
|
|
44 |
withParentLoginPopover={true}
|
45 |
+
on:run
|
46 |
on:logInPopover={() => (popOverOpen = true)}
|
47 |
/>
|
48 |
</div>
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetRealtimeRecorder/WidgetRealtimeRecorder.svelte
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<script lang="ts">
|
2 |
import type { WidgetProps } from "../../..//InferenceWidget/shared/types.js";
|
3 |
-
import { onDestroy, onMount } from "svelte";
|
4 |
import IconMagicWand from "../../..//Icons/IconMagicWand.svelte";
|
5 |
import Recorder from "./Recorder.js";
|
6 |
|
@@ -8,9 +8,8 @@
|
|
8 |
export let classNames = "";
|
9 |
export let model: WidgetProps["model"];
|
10 |
export let updateModelLoading: (isLoading: boolean, estimatedTime?: number) => void;
|
11 |
-
|
12 |
-
|
13 |
-
export let onError: (err: string) => void = () => null;
|
14 |
|
15 |
let isRecording = false;
|
16 |
let recorder: Recorder;
|
@@ -21,35 +20,35 @@
|
|
21 |
try {
|
22 |
isRecording = !isRecording;
|
23 |
if (isRecording) {
|
24 |
-
|
25 |
await recorder.start();
|
26 |
} else {
|
27 |
-
|
28 |
txt = "";
|
29 |
updateModelLoading(false);
|
30 |
recorder.stop();
|
31 |
}
|
32 |
} catch (e) {
|
33 |
isRecording = false;
|
34 |
-
|
35 |
updateModelLoading(false);
|
36 |
if (e instanceof Error) {
|
37 |
switch (e.name) {
|
38 |
case "NotAllowedError": {
|
39 |
-
|
40 |
break;
|
41 |
}
|
42 |
case "NotFoundError": {
|
43 |
-
|
44 |
break;
|
45 |
}
|
46 |
default: {
|
47 |
-
|
48 |
break;
|
49 |
}
|
50 |
}
|
51 |
} else {
|
52 |
-
|
53 |
}
|
54 |
}
|
55 |
}
|
@@ -57,18 +56,25 @@
|
|
57 |
function renderText(_txt: string) {
|
58 |
warning = "";
|
59 |
txt = _txt;
|
60 |
-
|
61 |
updateModelLoading(false);
|
62 |
}
|
63 |
|
64 |
function renderWarning(_warning: string) {
|
65 |
warning = _warning;
|
66 |
-
|
67 |
updateModelLoading(false);
|
68 |
}
|
69 |
|
70 |
onMount(() => {
|
71 |
-
recorder = new Recorder(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
});
|
73 |
|
74 |
onDestroy(() => {
|
|
|
1 |
<script lang="ts">
|
2 |
import type { WidgetProps } from "../../..//InferenceWidget/shared/types.js";
|
3 |
+
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
4 |
import IconMagicWand from "../../..//Icons/IconMagicWand.svelte";
|
5 |
import Recorder from "./Recorder.js";
|
6 |
|
|
|
8 |
export let classNames = "";
|
9 |
export let model: WidgetProps["model"];
|
10 |
export let updateModelLoading: (isLoading: boolean, estimatedTime?: number) => void;
|
11 |
+
|
12 |
+
const dispatch = createEventDispatcher<{ start: void; stop: void; error: string }>();
|
|
|
13 |
|
14 |
let isRecording = false;
|
15 |
let recorder: Recorder;
|
|
|
20 |
try {
|
21 |
isRecording = !isRecording;
|
22 |
if (isRecording) {
|
23 |
+
dispatch("start");
|
24 |
await recorder.start();
|
25 |
} else {
|
26 |
+
dispatch("stop");
|
27 |
txt = "";
|
28 |
updateModelLoading(false);
|
29 |
recorder.stop();
|
30 |
}
|
31 |
} catch (e) {
|
32 |
isRecording = false;
|
33 |
+
dispatch("stop");
|
34 |
updateModelLoading(false);
|
35 |
if (e instanceof Error) {
|
36 |
switch (e.name) {
|
37 |
case "NotAllowedError": {
|
38 |
+
dispatch("error", "Please allow access to your microphone & refresh the page");
|
39 |
break;
|
40 |
}
|
41 |
case "NotFoundError": {
|
42 |
+
dispatch("error", "No microphone found on your device");
|
43 |
break;
|
44 |
}
|
45 |
default: {
|
46 |
+
dispatch("error", `${e.name}: ${e.message}`);
|
47 |
break;
|
48 |
}
|
49 |
}
|
50 |
} else {
|
51 |
+
dispatch("error", String(e));
|
52 |
}
|
53 |
}
|
54 |
}
|
|
|
56 |
function renderText(_txt: string) {
|
57 |
warning = "";
|
58 |
txt = _txt;
|
59 |
+
dispatch("error", "");
|
60 |
updateModelLoading(false);
|
61 |
}
|
62 |
|
63 |
function renderWarning(_warning: string) {
|
64 |
warning = _warning;
|
65 |
+
dispatch("error", "");
|
66 |
updateModelLoading(false);
|
67 |
}
|
68 |
|
69 |
onMount(() => {
|
70 |
+
recorder = new Recorder(
|
71 |
+
model.id,
|
72 |
+
apiToken,
|
73 |
+
renderText,
|
74 |
+
renderWarning,
|
75 |
+
(err: string) => dispatch("error", err),
|
76 |
+
updateModelLoading
|
77 |
+
);
|
78 |
});
|
79 |
|
80 |
onDestroy(() => {
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetRecorder/WidgetRecorder.svelte
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
<script lang="ts">
|
2 |
-
import { onDestroy, onMount } from "svelte";
|
3 |
|
4 |
import IconMicrophone from "../../..//Icons/IconMicrophone.svelte";
|
5 |
|
6 |
import Recorder from "./Recorder.js";
|
7 |
|
8 |
export let classNames = "";
|
9 |
-
|
10 |
-
|
11 |
-
export let onError: (err: string) => void = () => null;
|
12 |
|
13 |
let isRecording = false;
|
14 |
let recorder: Recorder;
|
@@ -28,30 +27,30 @@
|
|
28 |
isRecording = !isRecording;
|
29 |
if (isRecording) {
|
30 |
await recorder.start();
|
31 |
-
|
32 |
} else {
|
33 |
const blob = await recorder.stopRecording();
|
34 |
-
|
35 |
}
|
36 |
} catch (e) {
|
37 |
isRecording = false;
|
38 |
if (e instanceof Error) {
|
39 |
switch (e.name) {
|
40 |
case "NotAllowedError": {
|
41 |
-
|
42 |
break;
|
43 |
}
|
44 |
case "NotFoundError": {
|
45 |
-
|
46 |
break;
|
47 |
}
|
48 |
default: {
|
49 |
-
|
50 |
break;
|
51 |
}
|
52 |
}
|
53 |
} else {
|
54 |
-
|
55 |
}
|
56 |
}
|
57 |
}
|
|
|
1 |
<script lang="ts">
|
2 |
+
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
3 |
|
4 |
import IconMicrophone from "../../..//Icons/IconMicrophone.svelte";
|
5 |
|
6 |
import Recorder from "./Recorder.js";
|
7 |
|
8 |
export let classNames = "";
|
9 |
+
|
10 |
+
const dispatch = createEventDispatcher<{ start: void; stop: Blob; error: string }>();
|
|
|
11 |
|
12 |
let isRecording = false;
|
13 |
let recorder: Recorder;
|
|
|
27 |
isRecording = !isRecording;
|
28 |
if (isRecording) {
|
29 |
await recorder.start();
|
30 |
+
dispatch("start");
|
31 |
} else {
|
32 |
const blob = await recorder.stopRecording();
|
33 |
+
dispatch("stop", blob);
|
34 |
}
|
35 |
} catch (e) {
|
36 |
isRecording = false;
|
37 |
if (e instanceof Error) {
|
38 |
switch (e.name) {
|
39 |
case "NotAllowedError": {
|
40 |
+
dispatch("error", "Please allow access to your microphone & refresh the page");
|
41 |
break;
|
42 |
}
|
43 |
case "NotFoundError": {
|
44 |
+
dispatch("error", "No microphone found on your device");
|
45 |
break;
|
46 |
}
|
47 |
default: {
|
48 |
+
dispatch("error", `Encountered error "${e.name}: ${e.message}"`);
|
49 |
break;
|
50 |
}
|
51 |
}
|
52 |
} else {
|
53 |
+
dispatch("error", String(e));
|
54 |
}
|
55 |
}
|
56 |
}
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetSubmitBtn/WidgetSubmitBtn.svelte
CHANGED
@@ -8,12 +8,11 @@
|
|
8 |
export let isDisabled = false;
|
9 |
export let isLoading: boolean;
|
10 |
export let label = "Compute";
|
11 |
-
export let onClick: () => void;
|
12 |
export let withParentLoginPopover = false;
|
13 |
|
14 |
let popOverOpen = false;
|
15 |
|
16 |
-
const dispatch = createEventDispatcher<{ logInPopover: void }>();
|
17 |
|
18 |
function _onClick() {
|
19 |
if (!$isLoggedIn) {
|
@@ -26,7 +25,7 @@
|
|
26 |
return;
|
27 |
}
|
28 |
|
29 |
-
|
30 |
}
|
31 |
</script>
|
32 |
|
|
|
8 |
export let isDisabled = false;
|
9 |
export let isLoading: boolean;
|
10 |
export let label = "Compute";
|
|
|
11 |
export let withParentLoginPopover = false;
|
12 |
|
13 |
let popOverOpen = false;
|
14 |
|
15 |
+
const dispatch = createEventDispatcher<{ logInPopover: void; run: void }>();
|
16 |
|
17 |
function _onClick() {
|
18 |
if (!$isLoggedIn) {
|
|
|
25 |
return;
|
26 |
}
|
27 |
|
28 |
+
dispatch("run");
|
29 |
}
|
30 |
</script>
|
31 |
|
packages/widgets/src/lib/components/InferenceWidget/shared/WidgetTableInput/WidgetTableInput.svelte
CHANGED
@@ -1,20 +1,23 @@
|
|
1 |
<script lang="ts">
|
2 |
import type { HighlightCoordinates } from "../types.js";
|
3 |
|
4 |
-
import { onMount, tick } from "svelte";
|
5 |
|
6 |
import { scrollToMax } from "../../../../utils/ViewUtils.js";
|
7 |
import IconRow from "../../..//Icons/IconRow.svelte";
|
8 |
|
9 |
-
|
|
|
10 |
export let highlighted: HighlightCoordinates;
|
11 |
-
export let table:
|
12 |
export let canAddRow = true;
|
13 |
export let canAddCol = true;
|
14 |
export let isLoading = false;
|
15 |
export let isDisabled = false;
|
16 |
|
17 |
-
|
|
|
|
|
18 |
let tableContainerEl: HTMLElement;
|
19 |
|
20 |
onMount(() => {
|
@@ -23,7 +26,7 @@
|
|
23 |
|
24 |
async function addCol() {
|
25 |
const updatedTable = table.map((row, colIndex) => [...row, colIndex === 0 ? `Header ${table[0].length + 1}` : ""]);
|
26 |
-
|
27 |
await scrollTableToRight();
|
28 |
}
|
29 |
|
@@ -34,7 +37,7 @@
|
|
34 |
|
35 |
function addRow() {
|
36 |
const updatedTable = [...table, Array(table[0].length).fill("")];
|
37 |
-
|
38 |
}
|
39 |
|
40 |
function editCell(e: Event, [x, y]: [number, number]) {
|
@@ -43,7 +46,7 @@
|
|
43 |
const updatedTable = table.map((row, rowIndex) =>
|
44 |
rowIndex === y ? row.map((col, colIndex) => (colIndex === x ? value : col)) : row
|
45 |
);
|
46 |
-
|
47 |
}
|
48 |
|
49 |
function onKeyDown(e: KeyboardEvent) {
|
@@ -54,7 +57,7 @@
|
|
54 |
|
55 |
function resetTable() {
|
56 |
const updatedTable = initialTable;
|
57 |
-
|
58 |
}
|
59 |
</script>
|
60 |
|
|
|
1 |
<script lang="ts">
|
2 |
import type { HighlightCoordinates } from "../types.js";
|
3 |
|
4 |
+
import { createEventDispatcher, onMount, tick } from "svelte";
|
5 |
|
6 |
import { scrollToMax } from "../../../../utils/ViewUtils.js";
|
7 |
import IconRow from "../../..//Icons/IconRow.svelte";
|
8 |
|
9 |
+
type Table = (string | number)[][];
|
10 |
+
|
11 |
export let highlighted: HighlightCoordinates;
|
12 |
+
export let table: Table = [[]];
|
13 |
export let canAddRow = true;
|
14 |
export let canAddCol = true;
|
15 |
export let isLoading = false;
|
16 |
export let isDisabled = false;
|
17 |
|
18 |
+
const dispatch = createEventDispatcher<{ change: Table }>();
|
19 |
+
|
20 |
+
let initialTable: Table = [[]];
|
21 |
let tableContainerEl: HTMLElement;
|
22 |
|
23 |
onMount(() => {
|
|
|
26 |
|
27 |
async function addCol() {
|
28 |
const updatedTable = table.map((row, colIndex) => [...row, colIndex === 0 ? `Header ${table[0].length + 1}` : ""]);
|
29 |
+
dispatch("change", updatedTable);
|
30 |
await scrollTableToRight();
|
31 |
}
|
32 |
|
|
|
37 |
|
38 |
function addRow() {
|
39 |
const updatedTable = [...table, Array(table[0].length).fill("")];
|
40 |
+
dispatch("change", updatedTable);
|
41 |
}
|
42 |
|
43 |
function editCell(e: Event, [x, y]: [number, number]) {
|
|
|
46 |
const updatedTable = table.map((row, rowIndex) =>
|
47 |
rowIndex === y ? row.map((col, colIndex) => (colIndex === x ? value : col)) : row
|
48 |
);
|
49 |
+
dispatch("change", updatedTable);
|
50 |
}
|
51 |
|
52 |
function onKeyDown(e: KeyboardEvent) {
|
|
|
57 |
|
58 |
function resetTable() {
|
59 |
const updatedTable = initialTable;
|
60 |
+
dispatch("change", updatedTable);
|
61 |
}
|
62 |
</script>
|
63 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/AudioClassificationWidget/AudioClassificationWidget.svelte
CHANGED
@@ -162,21 +162,19 @@
|
|
162 |
<WidgetHeader {noTitle} {model} {isLoading} {isDisabled} {callApiOnMount} {applyWidgetExample} {validateExample} />
|
163 |
|
164 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
165 |
-
<WidgetFileInput accept="audio/*" classNames="mt-1.5 mr-2" {onSelectFile} />
|
166 |
<span class="mr-2 mt-1.5">or</span>
|
167 |
-
<WidgetRecorder
|
|
|
|
|
|
|
|
|
|
|
168 |
</div>
|
169 |
{#if fileUrl}
|
170 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
171 |
{/if}
|
172 |
-
<WidgetSubmitBtn
|
173 |
-
classNames="mt-2"
|
174 |
-
isDisabled={isRecording || isDisabled}
|
175 |
-
{isLoading}
|
176 |
-
onClick={() => {
|
177 |
-
getOutput();
|
178 |
-
}}
|
179 |
-
/>
|
180 |
{#if warning}
|
181 |
<div class="alert alert-warning mt-2">{warning}</div>
|
182 |
{/if}
|
|
|
162 |
<WidgetHeader {noTitle} {model} {isLoading} {isDisabled} {callApiOnMount} {applyWidgetExample} {validateExample} />
|
163 |
|
164 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
165 |
+
<WidgetFileInput accept="audio/*" classNames="mt-1.5 mr-2" on:run={(e) => onSelectFile(e.detail)} />
|
166 |
<span class="mr-2 mt-1.5">or</span>
|
167 |
+
<WidgetRecorder
|
168 |
+
classNames="mt-1.5"
|
169 |
+
on:start={() => onRecordStart()}
|
170 |
+
on:stop={(e) => onSelectFile(e.detail)}
|
171 |
+
on:error={(e) => onRecordError(e.detail)}
|
172 |
+
/>
|
173 |
</div>
|
174 |
{#if fileUrl}
|
175 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
176 |
{/if}
|
177 |
+
<WidgetSubmitBtn classNames="mt-2" isDisabled={isRecording || isDisabled} {isLoading} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
{#if warning}
|
179 |
<div class="alert alert-warning mt-2">{warning}</div>
|
180 |
{/if}
|
packages/widgets/src/lib/components/InferenceWidget/widgets/AudioToAudioWidget/AudioToAudioWidget.svelte
CHANGED
@@ -160,21 +160,19 @@
|
|
160 |
/>
|
161 |
|
162 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
163 |
-
<WidgetFileInput accept="audio/*" classNames="mt-1.5 mr-2" {onSelectFile} />
|
164 |
<span class="mr-2 mt-1.5">or</span>
|
165 |
-
<WidgetRecorder
|
|
|
|
|
|
|
|
|
|
|
166 |
</div>
|
167 |
{#if fileUrl}
|
168 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
169 |
{/if}
|
170 |
-
<WidgetSubmitBtn
|
171 |
-
classNames="mt-2"
|
172 |
-
isDisabled={isRecording || isDisabled}
|
173 |
-
{isLoading}
|
174 |
-
onClick={() => {
|
175 |
-
getOutput();
|
176 |
-
}}
|
177 |
-
/>
|
178 |
|
179 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
180 |
|
|
|
160 |
/>
|
161 |
|
162 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
163 |
+
<WidgetFileInput accept="audio/*" classNames="mt-1.5 mr-2" on:run={(e) => onSelectFile(e.detail)} />
|
164 |
<span class="mr-2 mt-1.5">or</span>
|
165 |
+
<WidgetRecorder
|
166 |
+
classNames="mt-1.5"
|
167 |
+
on:start={() => onRecordStart()}
|
168 |
+
on:stop={(e) => onSelectFile(e.detail)}
|
169 |
+
on:error={(e) => onRecordError(e.detail)}
|
170 |
+
/>
|
171 |
</div>
|
172 |
{#if fileUrl}
|
173 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
174 |
{/if}
|
175 |
+
<WidgetSubmitBtn classNames="mt-2" isDisabled={isRecording || isDisabled} {isLoading} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
178 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/AutomaticSpeechRecognitionWidget/AutomaticSpeechRecognitionWidget.svelte
CHANGED
@@ -168,9 +168,14 @@
|
|
168 |
|
169 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
170 |
{#if !isRealtimeRecording}
|
171 |
-
<WidgetFileInput accept="audio/*" classNames="mt-1.5" {onSelectFile} />
|
172 |
<span class="mx-2 mt-1.5">or</span>
|
173 |
-
<WidgetRecorder
|
|
|
|
|
|
|
|
|
|
|
174 |
{/if}
|
175 |
{#if model?.library_name === "transformers"}
|
176 |
{#if !isRealtimeRecording}
|
@@ -181,9 +186,9 @@
|
|
181 |
{apiToken}
|
182 |
{model}
|
183 |
{updateModelLoading}
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
/>
|
188 |
{/if}
|
189 |
</div>
|
@@ -191,14 +196,7 @@
|
|
191 |
{#if fileUrl}
|
192 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
193 |
{/if}
|
194 |
-
<WidgetSubmitBtn
|
195 |
-
classNames="mt-2"
|
196 |
-
isDisabled={isRecording || isDisabled}
|
197 |
-
{isLoading}
|
198 |
-
onClick={() => {
|
199 |
-
getOutput();
|
200 |
-
}}
|
201 |
-
/>
|
202 |
{#if warning}
|
203 |
<div class="alert alert-warning mt-2">{warning}</div>
|
204 |
{/if}
|
|
|
168 |
|
169 |
<div class="flex flex-wrap items-center {isDisabled ? 'pointer-events-none hidden opacity-50' : ''}">
|
170 |
{#if !isRealtimeRecording}
|
171 |
+
<WidgetFileInput accept="audio/*" classNames="mt-1.5" on:run={(e) => onSelectFile(e.detail)} />
|
172 |
<span class="mx-2 mt-1.5">or</span>
|
173 |
+
<WidgetRecorder
|
174 |
+
classNames="mt-1.5"
|
175 |
+
on:start={() => onRecordStart()}
|
176 |
+
on:stop={(e) => onSelectFile(e.detail)}
|
177 |
+
on:error={(e) => onRecordError(e.detail)}
|
178 |
+
/>
|
179 |
{/if}
|
180 |
{#if model?.library_name === "transformers"}
|
181 |
{#if !isRealtimeRecording}
|
|
|
186 |
{apiToken}
|
187 |
{model}
|
188 |
{updateModelLoading}
|
189 |
+
on:start={() => (isRealtimeRecording = true)}
|
190 |
+
on:stop={() => (isRealtimeRecording = false)}
|
191 |
+
on:error={(e) => onRecordError(e.detail)}
|
192 |
/>
|
193 |
{/if}
|
194 |
</div>
|
|
|
196 |
{#if fileUrl}
|
197 |
<WidgetAudioTrack classNames="mt-3" label={filename} src={fileUrl} />
|
198 |
{/if}
|
199 |
+
<WidgetSubmitBtn classNames="mt-2" isDisabled={isRecording || isDisabled} {isLoading} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
{#if warning}
|
201 |
<div class="alert alert-warning mt-2">{warning}</div>
|
202 |
{/if}
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ConversationalWidget/ConversationalWidget.svelte
CHANGED
@@ -266,8 +266,8 @@
|
|
266 |
flatTop={true}
|
267 |
{isLoading}
|
268 |
{isDisabled}
|
269 |
-
onClickSubmitBtn={handleNewMessage}
|
270 |
submitButtonLabel="Send"
|
|
|
271 |
on:cmdEnter={handleNewMessage}
|
272 |
/>
|
273 |
|
|
|
266 |
flatTop={true}
|
267 |
{isLoading}
|
268 |
{isDisabled}
|
|
|
269 |
submitButtonLabel="Send"
|
270 |
+
on:run={() => handleNewMessage()}
|
271 |
on:cmdEnter={handleNewMessage}
|
272 |
/>
|
273 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/FeatureExtractionWidget/FeatureExtractionWidget.svelte
CHANGED
@@ -138,9 +138,7 @@
|
|
138 |
bind:value={text}
|
139 |
{isLoading}
|
140 |
{isDisabled}
|
141 |
-
|
142 |
-
getOutput();
|
143 |
-
}}
|
144 |
on:cmdEnter={() => getOutput()}
|
145 |
/>
|
146 |
|
|
|
138 |
bind:value={text}
|
139 |
{isLoading}
|
140 |
{isDisabled}
|
141 |
+
on:run={() => getOutput()}
|
|
|
|
|
142 |
on:cmdEnter={() => getOutput()}
|
143 |
/>
|
144 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/FillMaskWidget/FillMaskWidget.svelte
CHANGED
@@ -143,14 +143,7 @@
|
|
143 |
</div>
|
144 |
{/if}
|
145 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
146 |
-
<WidgetSubmitBtn
|
147 |
-
classNames="mt-2"
|
148 |
-
{isLoading}
|
149 |
-
{isDisabled}
|
150 |
-
onClick={() => {
|
151 |
-
getOutput();
|
152 |
-
}}
|
153 |
-
/>
|
154 |
|
155 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
156 |
|
|
|
143 |
</div>
|
144 |
{/if}
|
145 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
146 |
+
<WidgetSubmitBtn classNames="mt-2" {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
149 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte
CHANGED
@@ -128,8 +128,8 @@
|
|
128 |
{isLoading}
|
129 |
{isDisabled}
|
130 |
{imgSrc}
|
131 |
-
{onSelectFile}
|
132 |
-
|
133 |
>
|
134 |
{#if imgSrc}
|
135 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
@@ -149,7 +149,7 @@
|
|
149 |
{isLoading}
|
150 |
{isDisabled}
|
151 |
label="Browse for image"
|
152 |
-
{onSelectFile}
|
153 |
/>
|
154 |
{#if warning}
|
155 |
<div class="alert alert-warning mt-2">{warning}</div>
|
|
|
128 |
{isLoading}
|
129 |
{isDisabled}
|
130 |
{imgSrc}
|
131 |
+
on:run={(e) => onSelectFile(e.detail)}
|
132 |
+
on:error={(e) => (error = e.detail)}
|
133 |
>
|
134 |
{#if imgSrc}
|
135 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
|
|
149 |
{isLoading}
|
150 |
{isDisabled}
|
151 |
label="Browse for image"
|
152 |
+
on:run={(e) => onSelectFile(e.detail)}
|
153 |
/>
|
154 |
{#if warning}
|
155 |
<div class="alert alert-warning mt-2">{warning}</div>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ImageSegmentationWidget/ImageSegmentationWidget.svelte
CHANGED
@@ -248,8 +248,8 @@
|
|
248 |
{isLoading}
|
249 |
{isDisabled}
|
250 |
{imgSrc}
|
251 |
-
{onSelectFile}
|
252 |
-
|
253 |
>
|
254 |
{#if imgSrc}
|
255 |
<Canvas {imgSrc} {highlightIndex} {mousemove} {mouseout} {output} />
|
@@ -265,7 +265,7 @@
|
|
265 |
{isLoading}
|
266 |
{isDisabled}
|
267 |
label="Browse for image"
|
268 |
-
{onSelectFile}
|
269 |
/>
|
270 |
{#if warning}
|
271 |
<div class="alert alert-warning mt-2">{warning}</div>
|
|
|
248 |
{isLoading}
|
249 |
{isDisabled}
|
250 |
{imgSrc}
|
251 |
+
on:run={(e) => onSelectFile(e.detail)}
|
252 |
+
on:error={(e) => (error = e.detail)}
|
253 |
>
|
254 |
{#if imgSrc}
|
255 |
<Canvas {imgSrc} {highlightIndex} {mousemove} {mouseout} {output} />
|
|
|
265 |
{isLoading}
|
266 |
{isDisabled}
|
267 |
label="Browse for image"
|
268 |
+
on:run={(e) => onSelectFile(e.detail)}
|
269 |
/>
|
270 |
{#if warning}
|
271 |
<div class="alert alert-warning mt-2">{warning}</div>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ImageToImageWidget/ImageToImageWidget.svelte
CHANGED
@@ -152,8 +152,8 @@
|
|
152 |
{isLoading}
|
153 |
{isDisabled}
|
154 |
{imgSrc}
|
155 |
-
{onSelectFile}
|
156 |
-
|
157 |
>
|
158 |
{#if imgSrc}
|
159 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
@@ -173,7 +173,7 @@
|
|
173 |
{isLoading}
|
174 |
{isDisabled}
|
175 |
label="Browse for image"
|
176 |
-
{onSelectFile}
|
177 |
/>
|
178 |
<WidgetTextInput
|
179 |
bind:value={prompt}
|
@@ -183,13 +183,7 @@
|
|
183 |
placeholder="Your prompt here..."
|
184 |
on:cmdEnter={() => getOutput()}
|
185 |
/>
|
186 |
-
<WidgetSubmitBtn
|
187 |
-
{isLoading}
|
188 |
-
{isDisabled}
|
189 |
-
onClick={() => {
|
190 |
-
getOutput();
|
191 |
-
}}
|
192 |
-
/>
|
193 |
</div>
|
194 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
195 |
|
|
|
152 |
{isLoading}
|
153 |
{isDisabled}
|
154 |
{imgSrc}
|
155 |
+
on:run={(e) => onSelectFile(e.detail)}
|
156 |
+
on:error={(e) => (error = e.detail)}
|
157 |
>
|
158 |
{#if imgSrc}
|
159 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
|
|
173 |
{isLoading}
|
174 |
{isDisabled}
|
175 |
label="Browse for image"
|
176 |
+
on:run={(e) => onSelectFile(e.detail)}
|
177 |
/>
|
178 |
<WidgetTextInput
|
179 |
bind:value={prompt}
|
|
|
183 |
placeholder="Your prompt here..."
|
184 |
on:cmdEnter={() => getOutput()}
|
185 |
/>
|
186 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
</div>
|
188 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
189 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ImageToTextWidget/ImageToTextWidget.svelte
CHANGED
@@ -123,8 +123,8 @@
|
|
123 |
{isLoading}
|
124 |
{isDisabled}
|
125 |
{imgSrc}
|
126 |
-
{onSelectFile}
|
127 |
-
|
128 |
>
|
129 |
{#if imgSrc}
|
130 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
@@ -144,7 +144,7 @@
|
|
144 |
{isLoading}
|
145 |
{isDisabled}
|
146 |
label="Browse for image"
|
147 |
-
{onSelectFile}
|
148 |
/>
|
149 |
{#if warning}
|
150 |
<div class="alert alert-warning mt-2">{warning}</div>
|
|
|
123 |
{isLoading}
|
124 |
{isDisabled}
|
125 |
{imgSrc}
|
126 |
+
on:run={(e) => onSelectFile(e.detail)}
|
127 |
+
on:error={(e) => (error = e.detail)}
|
128 |
>
|
129 |
{#if imgSrc}
|
130 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
|
|
144 |
{isLoading}
|
145 |
{isDisabled}
|
146 |
label="Browse for image"
|
147 |
+
on:run={(e) => onSelectFile(e.detail)}
|
148 |
/>
|
149 |
{#if warning}
|
150 |
<div class="alert alert-warning mt-2">{warning}</div>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ObjectDetectionWidget/ObjectDetectionWidget.svelte
CHANGED
@@ -160,8 +160,8 @@
|
|
160 |
{isLoading}
|
161 |
{isDisabled}
|
162 |
{imgSrc}
|
163 |
-
{onSelectFile}
|
164 |
-
|
165 |
>
|
166 |
{#if imgSrc}
|
167 |
<BoundingBoxes {imgSrc} {mouseover} {mouseout} {output} {highlightIndex} />
|
@@ -177,7 +177,7 @@
|
|
177 |
{isLoading}
|
178 |
{isDisabled}
|
179 |
label="Browse for image"
|
180 |
-
{onSelectFile}
|
181 |
/>
|
182 |
{#if warning}
|
183 |
<div class="alert alert-warning mt-2">{warning}</div>
|
|
|
160 |
{isLoading}
|
161 |
{isDisabled}
|
162 |
{imgSrc}
|
163 |
+
on:run={(e) => onSelectFile(e.detail)}
|
164 |
+
on:error={(e) => (error = e.detail)}
|
165 |
>
|
166 |
{#if imgSrc}
|
167 |
<BoundingBoxes {imgSrc} {mouseover} {mouseout} {output} {highlightIndex} />
|
|
|
177 |
{isLoading}
|
178 |
{isDisabled}
|
179 |
label="Browse for image"
|
180 |
+
on:run={(e) => onSelectFile(e.detail)}
|
181 |
/>
|
182 |
{#if warning}
|
183 |
<div class="alert alert-warning mt-2">{warning}</div>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/QuestionAnsweringWidget/QuestionAnsweringWidget.svelte
CHANGED
@@ -138,9 +138,7 @@
|
|
138 |
bind:value={question}
|
139 |
{isLoading}
|
140 |
{isDisabled}
|
141 |
-
|
142 |
-
getOutput();
|
143 |
-
}}
|
144 |
on:cmdEnter={() => getOutput()}
|
145 |
/>
|
146 |
<WidgetTextarea
|
|
|
138 |
bind:value={question}
|
139 |
{isLoading}
|
140 |
{isDisabled}
|
141 |
+
on:run={() => getOutput()}
|
|
|
|
|
142 |
on:cmdEnter={() => getOutput()}
|
143 |
/>
|
144 |
<WidgetTextarea
|
packages/widgets/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte
CHANGED
@@ -174,17 +174,11 @@
|
|
174 |
{/each}
|
175 |
<WidgetAddSentenceBtn
|
176 |
isDisabled={nComparisonSentences === maxComparisonSentences || isDisabled}
|
177 |
-
|
178 |
nComparisonSentences++;
|
179 |
}}
|
180 |
/>
|
181 |
-
<WidgetSubmitBtn
|
182 |
-
{isLoading}
|
183 |
-
{isDisabled}
|
184 |
-
onClick={() => {
|
185 |
-
getOutput();
|
186 |
-
}}
|
187 |
-
/>
|
188 |
</div>
|
189 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
190 |
|
|
|
174 |
{/each}
|
175 |
<WidgetAddSentenceBtn
|
176 |
isDisabled={nComparisonSentences === maxComparisonSentences || isDisabled}
|
177 |
+
on:click={() => {
|
178 |
nComparisonSentences++;
|
179 |
}}
|
180 |
/>
|
181 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
</div>
|
183 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
184 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/SummarizationWidget/SummarizationWidget.svelte
CHANGED
@@ -118,13 +118,7 @@
|
|
118 |
/>
|
119 |
<div class="space-y-2">
|
120 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
121 |
-
<WidgetSubmitBtn
|
122 |
-
{isLoading}
|
123 |
-
{isDisabled}
|
124 |
-
onClick={() => {
|
125 |
-
getOutput();
|
126 |
-
}}
|
127 |
-
/>
|
128 |
</div>
|
129 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
130 |
|
|
|
118 |
/>
|
119 |
<div class="space-y-2">
|
120 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
121 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
</div>
|
123 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
124 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TableQuestionAnsweringWidget/TableQuestionAnsweringWidget.svelte
CHANGED
@@ -171,9 +171,7 @@
|
|
171 |
bind:value={query}
|
172 |
{isLoading}
|
173 |
{isDisabled}
|
174 |
-
|
175 |
-
getOutput();
|
176 |
-
}}
|
177 |
on:cmdEnter={() => getOutput()}
|
178 |
/>
|
179 |
|
@@ -182,7 +180,7 @@
|
|
182 |
<WidgetOutputTableQA {output} {isAnswerOnlyOutput} />
|
183 |
{/if}
|
184 |
{#if table.length > 1 || table[0].length > 1}
|
185 |
-
<WidgetTableInput {highlighted}
|
186 |
{/if}
|
187 |
</div>
|
188 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
|
|
171 |
bind:value={query}
|
172 |
{isLoading}
|
173 |
{isDisabled}
|
174 |
+
on:run={() => getOutput()}
|
|
|
|
|
175 |
on:cmdEnter={() => getOutput()}
|
176 |
/>
|
177 |
|
|
|
180 |
<WidgetOutputTableQA {output} {isAnswerOnlyOutput} />
|
181 |
{/if}
|
182 |
{#if table.length > 1 || table[0].length > 1}
|
183 |
+
<WidgetTableInput {highlighted} on:change={(e) => onChangeTable(e.detail)} {table} {isDisabled} />
|
184 |
{/if}
|
185 |
</div>
|
186 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TabularDataWidget/TabularDataWidget.svelte
CHANGED
@@ -197,20 +197,14 @@
|
|
197 |
{highlighted}
|
198 |
{isLoading}
|
199 |
{isDisabled}
|
200 |
-
|
201 |
table={tableWithOutput}
|
202 |
canAddCol={false}
|
203 |
bind:scrollTableToRight
|
204 |
/>
|
205 |
{/if}
|
206 |
</div>
|
207 |
-
<WidgetSubmitBtn
|
208 |
-
{isLoading}
|
209 |
-
{isDisabled}
|
210 |
-
onClick={() => {
|
211 |
-
getOutput();
|
212 |
-
}}
|
213 |
-
/>
|
214 |
|
215 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
216 |
<WidgetFooter {model} {isDisabled} {outputJson} />
|
|
|
197 |
{highlighted}
|
198 |
{isLoading}
|
199 |
{isDisabled}
|
200 |
+
on:change={(e) => onChangeTable(e.detail)}
|
201 |
table={tableWithOutput}
|
202 |
canAddCol={false}
|
203 |
bind:scrollTableToRight
|
204 |
/>
|
205 |
{/if}
|
206 |
</div>
|
207 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
210 |
<WidgetFooter {model} {isDisabled} {outputJson} />
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte
CHANGED
@@ -222,7 +222,7 @@
|
|
222 |
<WidgetSubmitBtn
|
223 |
{isLoading}
|
224 |
{isDisabled}
|
225 |
-
|
226 |
getOutput({ useCache });
|
227 |
}}
|
228 |
/>
|
|
|
222 |
<WidgetSubmitBtn
|
223 |
{isLoading}
|
224 |
{isDisabled}
|
225 |
+
on:run={() => {
|
226 |
getOutput({ useCache });
|
227 |
}}
|
228 |
/>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TextToImageWidget/TextToImageWidget.svelte
CHANGED
@@ -126,7 +126,7 @@
|
|
126 |
bind:value={text}
|
127 |
{isLoading}
|
128 |
{isDisabled}
|
129 |
-
|
130 |
on:cmdEnter={() => getOutput()}
|
131 |
/>
|
132 |
|
|
|
126 |
bind:value={text}
|
127 |
{isLoading}
|
128 |
{isDisabled}
|
129 |
+
on:run={() => getOutput()}
|
130 |
on:cmdEnter={() => getOutput()}
|
131 |
/>
|
132 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte
CHANGED
@@ -117,14 +117,7 @@
|
|
117 |
/>
|
118 |
|
119 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
120 |
-
<WidgetSubmitBtn
|
121 |
-
classNames="mt-2"
|
122 |
-
{isLoading}
|
123 |
-
{isDisabled}
|
124 |
-
onClick={() => {
|
125 |
-
getOutput();
|
126 |
-
}}
|
127 |
-
/>
|
128 |
|
129 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
130 |
|
|
|
117 |
/>
|
118 |
|
119 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
120 |
+
<WidgetSubmitBtn classNames="mt-2" {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
123 |
|
packages/widgets/src/lib/components/InferenceWidget/widgets/TokenClassificationWidget/TokenClassificationWidget.svelte
CHANGED
@@ -238,14 +238,7 @@
|
|
238 |
/>
|
239 |
|
240 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
241 |
-
<WidgetSubmitBtn
|
242 |
-
classNames="mt-2"
|
243 |
-
{isLoading}
|
244 |
-
{isDisabled}
|
245 |
-
onClick={() => {
|
246 |
-
getOutput();
|
247 |
-
}}
|
248 |
-
/>
|
249 |
{#if warning}
|
250 |
<div class="alert alert-warning mt-2">{warning}</div>
|
251 |
{/if}
|
|
|
238 |
/>
|
239 |
|
240 |
<WidgetTextarea bind:value={text} bind:setValue={setTextAreaValue} {isDisabled} on:cmdEnter={() => getOutput()} />
|
241 |
+
<WidgetSubmitBtn classNames="mt-2" {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
{#if warning}
|
243 |
<div class="alert alert-warning mt-2">{warning}</div>
|
244 |
{/if}
|
packages/widgets/src/lib/components/InferenceWidget/widgets/VisualQuestionAnsweringWidget/VisualQuestionAnsweringWidget.svelte
CHANGED
@@ -163,8 +163,8 @@
|
|
163 |
{isLoading}
|
164 |
{isDisabled}
|
165 |
{imgSrc}
|
166 |
-
{onSelectFile}
|
167 |
-
|
168 |
>
|
169 |
{#if imgSrc}
|
170 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
@@ -184,15 +184,13 @@
|
|
184 |
{isLoading}
|
185 |
{isDisabled}
|
186 |
label="Browse for image"
|
187 |
-
{onSelectFile}
|
188 |
/>
|
189 |
<WidgetQuickInput
|
190 |
bind:value={question}
|
191 |
{isLoading}
|
192 |
{isDisabled}
|
193 |
-
|
194 |
-
getOutput();
|
195 |
-
}}
|
196 |
on:cmdEnter={() => getOutput()}
|
197 |
/>
|
198 |
</div>
|
|
|
163 |
{isLoading}
|
164 |
{isDisabled}
|
165 |
{imgSrc}
|
166 |
+
on:run={(e) => onSelectFile(e.detail)}
|
167 |
+
on:error={(e) => (error = e.detail)}
|
168 |
>
|
169 |
{#if imgSrc}
|
170 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
|
|
184 |
{isLoading}
|
185 |
{isDisabled}
|
186 |
label="Browse for image"
|
187 |
+
on:run={(e) => onSelectFile(e.detail)}
|
188 |
/>
|
189 |
<WidgetQuickInput
|
190 |
bind:value={question}
|
191 |
{isLoading}
|
192 |
{isDisabled}
|
193 |
+
on:run={() => getOutput()}
|
|
|
|
|
194 |
on:cmdEnter={() => getOutput()}
|
195 |
/>
|
196 |
</div>
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ZeroShotClassificationWidget/ZeroShotClassificationWidget.svelte
CHANGED
@@ -175,13 +175,7 @@
|
|
175 |
on:cmdEnter={() => getOutput()}
|
176 |
/>
|
177 |
<WidgetCheckbox bind:checked={multiClass} label="Allow multiple true classes" />
|
178 |
-
<WidgetSubmitBtn
|
179 |
-
{isLoading}
|
180 |
-
{isDisabled}
|
181 |
-
onClick={() => {
|
182 |
-
getOutput();
|
183 |
-
}}
|
184 |
-
/>
|
185 |
{#if warning}
|
186 |
<div class="alert alert-warning mt-2">{warning}</div>
|
187 |
{/if}
|
|
|
175 |
on:cmdEnter={() => getOutput()}
|
176 |
/>
|
177 |
<WidgetCheckbox bind:checked={multiClass} label="Allow multiple true classes" />
|
178 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
{#if warning}
|
180 |
<div class="alert alert-warning mt-2">{warning}</div>
|
181 |
{/if}
|
packages/widgets/src/lib/components/InferenceWidget/widgets/ZeroShotImageClassificationWidget/ZeroShotImageClassificationWidget.svelte
CHANGED
@@ -164,8 +164,8 @@
|
|
164 |
{isLoading}
|
165 |
{isDisabled}
|
166 |
{imgSrc}
|
167 |
-
{onSelectFile}
|
168 |
-
|
169 |
>
|
170 |
{#if imgSrc}
|
171 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
@@ -185,7 +185,7 @@
|
|
185 |
{isLoading}
|
186 |
{isDisabled}
|
187 |
label="Browse for image"
|
188 |
-
{onSelectFile}
|
189 |
/>
|
190 |
<WidgetTextInput
|
191 |
bind:value={candidateLabels}
|
@@ -195,13 +195,7 @@
|
|
195 |
placeholder="Possible class names..."
|
196 |
on:cmdEnter={() => getOutput()}
|
197 |
/>
|
198 |
-
<WidgetSubmitBtn
|
199 |
-
{isLoading}
|
200 |
-
{isDisabled}
|
201 |
-
onClick={() => {
|
202 |
-
getOutput();
|
203 |
-
}}
|
204 |
-
/>
|
205 |
</div>
|
206 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
207 |
|
|
|
164 |
{isLoading}
|
165 |
{isDisabled}
|
166 |
{imgSrc}
|
167 |
+
on:run={(e) => onSelectFile(e.detail)}
|
168 |
+
on:error={(e) => (error = e.detail)}
|
169 |
>
|
170 |
{#if imgSrc}
|
171 |
<img src={imgSrc} class="pointer-events-none mx-auto max-h-44 shadow" alt="" />
|
|
|
185 |
{isLoading}
|
186 |
{isDisabled}
|
187 |
label="Browse for image"
|
188 |
+
on:run={(e) => onSelectFile(e.detail)}
|
189 |
/>
|
190 |
<WidgetTextInput
|
191 |
bind:value={candidateLabels}
|
|
|
195 |
placeholder="Possible class names..."
|
196 |
on:cmdEnter={() => getOutput()}
|
197 |
/>
|
198 |
+
<WidgetSubmitBtn {isLoading} {isDisabled} on:run={() => getOutput()} />
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
</div>
|
200 |
<WidgetInfo {model} {computeTime} {error} {modelLoading} />
|
201 |
|