Query deployment to classify text

After the deployment is added successfully, you can query the deployment to classify text based on the model you assigned to the deployment. You can query the deployment programmatically Prediction API or through the client libraries (Azure SDK).

Test deployed model

You can use Language Studio to submit the custom text classification task and visualize the results.

To test your deployed models within Language Studio:

  1. Select Testing deployments from the menu on the left side of the screen.

  2. Select the deployment you want to test. You can only test models that are assigned to deployments.

  3. For multilingual projects, select the language of the text you're testing using the language dropdown.

  4. Select the deployment you want to query/test from the dropdown.

  5. Enter the text you want to submit in the request, or upload a .txt document to use. If you’re using one of the example datasets, you can use one of the included .txt files.

  6. Click on Run the test from the top menu.

  7. In the Result tab, you can see the predicted classes for your text. You can also view the JSON response under the JSON tab. The following example is for a single label classification project. A multi label classification project can return more than one class in the result.

    A screenshot showing model test results for a single label classification project.


Send a text classification request to your model

Tip

You can test your model in Language Studio by sending sample text to classify it.

  1. After the deployment job is completed successfully, select the deployment you want to use and from the top menu click on Get prediction URL.

    A screenshot showing the button to get the prediction U R L.

  2. In the window that appears, under the Submit pivot, copy the sample request URL and body into your command line.

  3. Replace <YOUR_DOCUMENT_HERE> with the actual text you want to extract entities from.

    A screenshot showing the prediction U R L and sample J SON request.

  4. Submit the POST cURL request in your terminal or command prompt. You'll receive a 202 response with the API results if the request was successful.

  5. In the response header you receive extract {JOB-ID} from operation-location, which has the format: {ENDPOINT}/text/analytics/v3.2-preview.2/analyze/jobs/<JOB-ID}>

  6. Back to Language Studio; select Retrieve pivot from the same window you got the example request you got earlier and copy the sample request into a text editor.

    A screenshot showing the button to retrieval U R L.

  7. Replace <JOB-ID> with the {JOB-ID} you extracted from the previous step.

  8. Submit the GET cURL request in your terminal or command prompt.

Next steps