diff --git a/js/src/lib/components/InferenceWidget/shared/WidgetExample.ts b/js/src/lib/components/InferenceWidget/shared/WidgetExample.ts index d642afd26..4b43c9ead 100644 --- a/js/src/lib/components/InferenceWidget/shared/WidgetExample.ts +++ b/js/src/lib/components/InferenceWidget/shared/WidgetExample.ts @@ -12,83 +12,78 @@ export interface WidgetExampleOutputText { export interface WidgetExampleOutputUrl { url: string; } + +export type WidgetExampleOutput = + | WidgetExampleOutputLabels + | WidgetExampleOutputAnswerScore + | WidgetExampleOutputText + | WidgetExampleOutputUrl; //#endregion -export interface WidgetExampleBase { +export interface WidgetExampleBase { example_title?: string; group?: string; + output?: TOutput; } -export interface WidgetExampleTextInputLabelsOutput extends WidgetExampleBase { - text: string; - output?: WidgetExampleOutputLabels; +export interface WidgetExampleTextInput extends WidgetExampleBase { + text: string; } -export interface WidgetExampleTextAndContextInputAnswerScoreOutput extends WidgetExampleBase { - text: string; +export interface WidgetExampleTextAndContextInput + extends WidgetExampleTextInput { context: string; - output?: WidgetExampleOutputAnswerScore; } -export interface WidgetExampleTextInputTextOutput extends WidgetExampleBase { - text: string; - output?: WidgetExampleOutputText; +export interface WidgetExampleTextAndTableInput extends WidgetExampleTextInput { + table: (string | number)[][]; } -export interface WidgetExampleTextInputUrlOutput extends WidgetExampleBase { - text: string; - output?: WidgetExampleOutputUrl; +export interface WidgetExampleAssetInput extends WidgetExampleBase { + src: string; } - -export interface WidgetExampleAssetInputLabelsOutput extends WidgetExampleBase { - src: string; - output?: WidgetExampleOutputLabels; +export interface WidgetExampleAssetAndPromptInput + extends WidgetExampleAssetInput { + prompt: string; } -export interface WidgetExampleAssetInputTextOutput extends WidgetExampleBase { - src: string; - output?: WidgetExampleOutputText; -} +export type WidgetExampleAssetAndTextInput = WidgetExampleAssetInput & + WidgetExampleTextInput; -export interface WidgetExampleAssetInputUrlOutput extends WidgetExampleBase { - src: string; - output?: WidgetExampleOutputUrl; -} +export type WidgetExampleAssetAndZeroShotInput = WidgetExampleAssetInput & + WidgetExampleZeroShotTextInput; -//#region more exotic stuff -export interface WidgetExampleStructuredDataInputLabelsOutput extends WidgetExampleBase { +export interface WidgetExampleStructuredDataInput extends WidgetExampleBase { structuredData: TableData; - output?: WidgetExampleOutputLabels; } -export interface WidgetExampleTableDataInputLabelsOutput extends WidgetExampleBase { - table: TableData; - output?: WidgetExampleOutputLabels; +export interface WidgetExampleTableDataInput extends WidgetExampleBase { + table: TableData; } -export interface WidgetExampleZeroShotTextInputLabelsOutput extends WidgetExampleBase { +export interface WidgetExampleZeroShotTextInput extends WidgetExampleTextInput { text: string; candidate_labels: string; multi_class: boolean; - output?: WidgetExampleOutputLabels; } -export interface WidgetExampleSentenceSimilarityInputLabelsOutput extends WidgetExampleBase { +export interface WidgetExampleSentenceSimilarityInput + extends WidgetExampleBase { source_sentence: string; sentences: string[]; - output?: WidgetExampleOutputLabels; } + //#endregion -export type WidgetExample = - | WidgetExampleTextInputLabelsOutput - | WidgetExampleTextAndContextInputAnswerScoreOutput - | WidgetExampleTextInputTextOutput - | WidgetExampleTextInputUrlOutput - | WidgetExampleAssetInputLabelsOutput - | WidgetExampleAssetInputTextOutput - | WidgetExampleAssetInputUrlOutput - | WidgetExampleStructuredDataInputLabelsOutput - | WidgetExampleTableDataInputLabelsOutput - | WidgetExampleZeroShotTextInputLabelsOutput - | WidgetExampleSentenceSimilarityInputLabelsOutput; +export type WidgetExample = + | WidgetExampleTextInput + | WidgetExampleTextAndContextInput + | WidgetExampleTextAndTableInput + | WidgetExampleAssetInput + | WidgetExampleAssetAndPromptInput + | WidgetExampleAssetAndTextInput + | WidgetExampleAssetAndZeroShotInput + | WidgetExampleStructuredDataInput + | WidgetExampleTableDataInput + | WidgetExampleZeroShotTextInput + | WidgetExampleSentenceSimilarityInput; diff --git a/js/src/lib/components/InferenceWidget/shared/WidgetInputSamples/WidgetInputSamples.svelte b/js/src/lib/components/InferenceWidget/shared/WidgetInputSamples/WidgetInputSamples.svelte index 59985626f..cc41078e1 100644 --- a/js/src/lib/components/InferenceWidget/shared/WidgetInputSamples/WidgetInputSamples.svelte +++ b/js/src/lib/components/InferenceWidget/shared/WidgetInputSamples/WidgetInputSamples.svelte @@ -1,15 +1,17 @@ -
diff --git a/js/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte b/js/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte index 57c82edee..eb6ee69c6 100644 --- a/js/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte +++ b/js/src/lib/components/InferenceWidget/widgets/ImageClassificationWidget/ImageClassificationWidget.svelte @@ -1,6 +1,6 @@ diff --git a/js/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte b/js/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte index 7d3f94884..a08755c22 100644 --- a/js/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte +++ b/js/src/lib/components/InferenceWidget/widgets/SentenceSimilarityWidget/SentenceSimilarityWidget.svelte @@ -1,5 +1,6 @@ diff --git a/js/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte b/js/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte index f266a0c43..870e5bb07 100644 --- a/js/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte +++ b/js/src/lib/components/InferenceWidget/widgets/TextToSpeechWidget/TextToSpeechWidget.svelte @@ -1,5 +1,6 @@