Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Adds placeholder text for testing NLP models #132486

Merged
merged 4 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import { i18n } from '@kbn/i18n';
import { InferenceBase, InferResponse } from '../inference_base';
import { getGeneralInputComponent } from '../text_input';
import { getNerOutputComponent } from './ner_output';
Expand Down Expand Up @@ -52,7 +52,10 @@ export class NerInference extends InferenceBase<NerResponse> {
}

public getInputComponent(): JSX.Element {
return getGeneralInputComponent(this);
const placeholder = i18n.translate('xpack.ml.trainedModels.testModelsFlyout.ner.inputText', {
defaultMessage: 'Enter a phrase to test',
});
return getGeneralInputComponent(this, placeholder);
}

public getOutputComponent(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ export class FillMaskInference extends InferenceBase<TextClassificationResponse>

public getInputComponent(): JSX.Element {
const placeholder = i18n.translate(
'xpack.ml.trainedModels.testModelsFlyout.langIdent.inputText',
'xpack.ml.trainedModels.testModelsFlyout.fillMask.inputText',
{
defaultMessage: 'Mask token: [MASK]. e.g. Paris is the [MASK] of France.',
defaultMessage:
'Enter a phrase to test. Use [MASK] as a placeholder for the missing words.',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { InferenceBase, InferenceType } from '../inference_base';
import { processResponse } from './common';
import { getGeneralInputComponent } from '../text_input';
Expand Down Expand Up @@ -44,7 +45,13 @@ export class LangIdentInference extends InferenceBase<TextClassificationResponse
}

public getInputComponent(): JSX.Element {
return getGeneralInputComponent(this);
const placeholder = i18n.translate(
'xpack.ml.trainedModels.testModelsFlyout.langIdent.inputText',
{
defaultMessage: 'Enter a phrase to test',
}
);
return getGeneralInputComponent(this, placeholder);
}

public getOutputComponent(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { InferenceBase } from '../inference_base';
import { processResponse } from './common';
import type { TextClassificationResponse, RawTextClassificationResponse } from './common';
Expand Down Expand Up @@ -45,7 +46,13 @@ export class TextClassificationInference extends InferenceBase<TextClassificatio
}

public getInputComponent(): JSX.Element {
return getGeneralInputComponent(this);
const placeholder = i18n.translate(
'xpack.ml.trainedModels.testModelsFlyout.textClassification.inputText',
{
defaultMessage: 'Enter a phrase to test',
}
);
return getGeneralInputComponent(this, placeholder);
}

public getOutputComponent(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import { i18n } from '@kbn/i18n';
import { InferenceBase, InferResponse } from '../inference_base';
import { getGeneralInputComponent } from '../text_input';
import { getTextEmbeddingOutputComponent } from './text_embedding_output';
Expand Down Expand Up @@ -53,7 +54,13 @@ export class TextEmbeddingInference extends InferenceBase<TextEmbeddingResponse>
}

public getInputComponent(): JSX.Element {
return getGeneralInputComponent(this);
const placeholder = i18n.translate(
'xpack.ml.trainedModels.testModelsFlyout.textEmbedding.inputText',
{
defaultMessage: 'Enter a phrase to test',
}
);
return getGeneralInputComponent(this, placeholder);
}

public getOutputComponent(): JSX.Element {
Expand Down