• Text Embedding

    This model can be used as the base model to any custom text classification model. Customers should use our Text Embedding model for the following use cases: topic analysis, sentiment analysis, custom text moderation, chatbot and email smart replies. Understand purchasing intent; understand audience sentiment; moderate user generated content; determine brand reputation; improve customer satisfaction and more.

    Request a demo

Request


You can call the Predict API with the "Text Embedding" model. Simply pass in a text input with a publicly accessible URL or by directly sending raw text, .csv or .tsv files.

Learn more about the Predict API.
API Guide

Python JS cURL
1
//Python
from clarifai_grpc.grpc.api import service_pb2, service_pb2_grpc, resources_pb2
from clarifai_grpc.grpc.api.status import status_code_pb2
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
import json

channel = ClarifaiChannel.get_json_channel()

stub = service_pb2_grpc.V2Stub(channel)


response = stub.PostModelOutputs(
    service_pb2.PostModelOutputsRequest(
        model_id="54286fce2de6cdfa11fedb3b498d2523",
        # By default, the latest model version will be used, but you can set it explicitly.
        # version_id=model_version_id,
        inputs=[
            resources_pb2.Input(data=resources_pb2.Data(text=resources_pb2.Text(raw="Butchart Gardens contains over 900 varieties of plants."))),
            resources_pb2.Input(data=resources_pb2.Data(text=resources_pb2.Text(url="https://samples.clarifai.com/negative_sentence_12.txt"))),
        ]
    ),
    metadata=(('authorization', 'Key YOUR_API_KEY'),)
)



if response.status.code != status_code_pb2.SUCCESS:
    raise Exception("Request failed, status code: "+ str(response.status.code))


print(response)

Response

The Predict API returns ‘vector’ and ‘num_dimensions’. The ‘vector’ is a numerical vector that represents the input text in a 768-dimensional space. The numerical values within the vectors are between 0 and 1, inclusive. The ‘num_dimensions’ for this model is set at 768.

Response
1
{
  "status": {
    "code": 10000,
    "description": "Ok"
  },
  "outputs": [
    {
      "id": "d2b6d1aa64c9541784e412347f582bc0",
      "status": {
        "code": 10000,
        "description": "Ok"
      },
      "created_at": "2017-04-06T17:43:28.573076Z",
      "model": {
        "name": "general-v1.3",
        "id": "bbb5f41425b8468d9b7a554ff10f8581",
        "created_at": "2016-06-05T17:26:32.302967Z",
        "app_id": null,
        "output_info": {
          "message": "Show output_info with: GET /models/{model_id}/output_info",
          "type": "embed",
          "type_ext": "embed"
        },
        "model_version": {
          "id": "bb7ac05c86be42d38b67bc473d333e07",
          "created_at": "2016-07-13T00:58:55.915745Z",
          "status": {
            "code": 21100,
            "description": "Model trained successfully"
          }
        }
        
      },
      "input": {
        "id": "afb815ae2cc84149bce35df866ade49e",
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/metro-north.jpg"
          }
        }
      },
      "data": {
        "embeddings": [
          {
            "vector": [
              0.03520518,
              0.012973542,
              0,
              0.010105805,
              0,
              0.14332126,
              0,
              0,
              0,
              0.12330104,
              0.0042665247,
              0,
              0.019420745,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.008716815,
              0,
              0,
              0,
              0,
              0.021344697,
              0.011986089,
              0,
              0,
              0.04004787,
              0,
              0.022243742,
              0,
              0,
              0.0105276005,
              0,
              0.00794854,
              0,
              0,
              0,
              0,
              0,
              0.027861306,
              0,
              0.16793193,
              0,
              0,
              0,
              0,
              0,
              0.045932036,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.01759685,
              0,
              0,
              0.046420667,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.018888272,
              0,
              0.053344935,
              0,
              0,
              0,
              0.041116066,
              0,
              0,
              0,
              0.023090852,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0025377553,
              0.045077156,
              0,
              0.06859251,
              0.021281091,
              0,
              0,
              0,
              0,
              0,
              0.042519677,
              0,
              0.094131544,
              0,
              0,
              0.056825448,
              0,
              0,
              0.057715654,
              0,
              0,
              0.0041584014,
              0,
              0,
              0,
              0,
              0,
              0.05688168,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.061837107,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.009388062,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.007484741,
              0,
              0,
              0.09071082,
              0,
              0.11347253,
              0,
              0,
              0,
              0,
              0.019105751,
              0.07770027,
              0.110860676,
              0,
              0,
              0.022533443,
              0,
              0.2795288,
              0.08114706,
              0,
              0,
              0,
              0.001699762,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.026297603,
              0,
              0,
              0.09172226,
              0,
              0,
              0,
              0,
              0.028776987,
              0,
              0.029765975,
              0,
              0.00783624,
              0,
              0,
              0.024649292,
              0.0072010444,
              0.028447289,
              0.07151946,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0021789446,
              0,
              0,
              0,
              0,
              0.030322812,
              0,
              0,
              0.0044091684,
              0,
              0.03885494,
              0,
              0.017633809,
              0,
              0.092704475,
              0.005220464,
              0.005599579,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.12104138,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.003343802,
              0,
              0,
              0.009374807,
              0,
              0,
              0,
              0,
              0.009856781,
              0.0022525014,
              0.012184342,
              0,
              0,
              0.06315578,
              0,
              0,
              0,
              0,
              0.045289755,
              0,
              0,
              0,
              0,
              0,
              0.05096393,
              0,
              0.016184777,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0035246252,
              0,
              0,
              0.015105468,
              0.06734182,
              0,
              0,
              0,
              0.11117244,
              0,
              0.103705816,
              0.13613166,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.05332645,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0020846906,
              0,
              0,
              0.024557762,
              0,
              0.043360062,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.16598432,
              0.0015353016,
              0,
              0,
              0,
              0,
              0.036458846,
              0,
              0.007933634,
              0,
              0.05570837,
              0,
              0,
              0,
              0,
              0,
              0.036146503,
              0,
              0,
              0,
              0,
              0.09601983,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.001435618,
              0.097432,
              0,
              0,
              0,
              0.040540256,
              0,
              0,
              0.025760768,
              0,
              0,
              0,
              0,
              0,
              0.09872375,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.10834194,
              0,
              0.003322302,
              0,
              0,
              0.000049534217,
              0,
              0,
              0.036076374,
              0,
              0,
              0,
              0,
              0,
              0.0016388076,
              0,
              0,
              0.15906423,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0269242,
              0,
              0,
              0,
              0,
              0.0009232165,
              0.091579944,
              0.0051145055,
              0,
              0,
              0,
              0,
              0.099991694,
              0,
              0.02664106,
              0,
              0,
              0.03288866,
              0,
              0,
              0,
              0,
              0,
              0,
              0.012989205,
              0,
              0.26686928,
              0.02540281,
              0,
              0.027089175,
              0.09392691,
              0,
              0,
              0.0039558713,
              0,
              0.009957928,
              0,
              0,
              0.10170139,
              0.0051507605,
              0.061983556,
              0,
              0.09481485,
              0,
              0,
              0.015096629,
              0.031032637,
              0,
              0,
              0,
              0.012067156,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.083590046,
              0,
              0,
              0.101295024,
              0.011973536,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0915086,
              0,
              0.050393987,
              0,
              0,
              0.02811605,
              0,
              0,
              0,
              0,
              0.06461936,
              0,
              0,
              0,
              0,
              0,
              0,
              0.031404328,
              0,
              0,
              0.002244817,
              0,
              0,
              0,
              0.013746623,
              0,
              0,
              0,
              0,
              0,
              0,
              0.037135895,
              0,
              0,
              0,
              0,
              0.010488344,
              0,
              0,
              0.10500787,
              0,
              0.024496317,
              0,
              0,
              0,
              0.030140376,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.035418373,
              0,
              0,
              0.10305073,
              0,
              0,
              0,
              0,
              0.110924184,
              0,
              0,
              0.086784825,
              0,
              0,
              0,
              0,
              0,
              0.02741879,
              0,
              0.078264,
              0.047749437,
              0,
              0,
              0,
              0,
              0.0018535086,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.043280024,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.07819502,
              0,
              0.003270174,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.098463625,
              0,
              0.026835497,
              0,
              0,
              0.074750945,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.020873843,
              0,
              0,
              0.02587114,
              0,
              0,
              0.06013487,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0121358195,
              0,
              0,
              0,
              0.06979532,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.022530567,
              0.12333595,
              0,
              0,
              0,
              0.049880702,
              0,
              0,
              0,
              0,
              0,
              0.018114597,
              0,
              0,
              0,
              0,
              0,
              0.004810177,
              0.041602235,
              0,
              0.25987333,
              0,
              0.0074298973,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.00811614,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0024609189,
              0,
              0,
              0,
              0,
              0.12744245,
              0.08060042,
              0,
              0,
              0,
              0,
              0.0762874,
              0,
              0,
              0,
              0,
              0,
              0.031960007,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.046239313,
              0,
              0,
              0,
              0.0010000347,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.015730146,
              0,
              0,
              0.0367509,
              0,
              0,
              0.011193443,
              0,
              0,
              0,
              0,
              0,
              0,
              0.10897141,
              0.13095929,
              0,
              0,
              0,
              0.06150859,
              0,
              0,
              0,
              0.017119821,
              0.012503269,
              0.0066578393,
              0,
              0.061775215,
              0,
              0.028748281,
              0.006242638,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.007975211,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.046092015,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.143938,
              0,
              0.023896405,
              0,
              0,
              0,
              0,
              0,
              0.110271536,
              0,
              0,
              0,
              0.052170373,
              0,
              0.021544116,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.06715044,
              0,
              0,
              0,
              0,
              0,
              0.08066482,
              0.02359071,
              0.07817921,
              0.021095702,
              0,
              0,
              0,
              0,
              0.013810605,
              0.011077386,
              0,
              0,
              0,
              0,
              0,
              0.0435915,
              0.074230865,
              0.06689954,
              0,
              0.029707821,
              0,
              0.0024582087,
              0,
              0.026778685,
              0.020589074,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.05246213,
              0,
              0,
              0,
              0,
              0.046066776,
              0,
              0.11776095,
              0.012370934,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.029394083,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0020741515,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.064333856,
              0.065608054,
              0.120295666,
              0,
              0,
              0.016120894,
              0.07778878,
              0.017969703,
              0,
              0.05618393,
              0.037524763,
              0,
              0,
              0,
              0,
              0,
              0,
              0.001676681,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.020574378,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.06367568,
              0.0035295154,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.0027838482,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0.05306438,
              0,
              0,
              0,
              0,
              0,
              0,
              0.006746299,
              0.12117918,
              0,
              0
            ],
            "num_dimensions": 1024
          }
        ]
      }
    }
  ]
}

Endless possibilities with Computer Vision and AI

Gather valuable business insights from images, text and data using machine learning, natural language processing and computer vision.

  • Ready-to-use Models
  • Text moderation

    Detect toxic, obscene, racist or threatening language, or train your own custom moderation models.

    Try it out
  • General embedding

    Analyze images and returns numerical vectors that represent each detected face in the image in a 1024-dimensional space computed by our General model.

    Try it out
  • Custom

    Create your own model and teach it with your own images and concepts.

    Try it out
  • General

    Recognize over 11,000 different concepts including objects, themes, moods and more.

    Try it out
  • Demographics

    Predict the age, gender or cultural appearances of faces.

    Try it out
  • Face detection

    Detect the location of faces with bounding boxes.

    Try it out
  • Celebrity

    Analyze images and return probability scores on the likelihood that the media contains the face(s) of over 10,000 recognized celebrities.

    Try it out
  • Apparel detection

    Detect items of clothing or fashion-related items.

    Try it out
  • Face embedding

    Analyze images and returns numerical vectors that represent each detected face in the image in a 1024-dimensional space.

    Try it out
  • Food

    Recognize more than 1,000 food items in images down to the ingredient level.

    Try it out
  • Color

    Identify the dominant colors present in your images in hex or W3C form.

    Try it out
  • Textures and patterns

    Recognize textures and patterns in a two-dimensional image e.g., feathers, woodgrain, petrified wood, glacial ice and overarching descriptive concepts (veined, metallic).

    Try it out
  • Not safe for work

    Identify different levels of nudity in your visual data. Ideal for moderating and filtering offensive content from your platform.

    Try it out
  • Travel

    Recognize specific features of residential, hotel, and travel-related properties.

    Try it out
  • Wedding

    Recognize over 400 concepts related to weddings including bride, groom, flowers and more.

    Try it out
  • Image moderation

    Identify unwanted content such as gore, drugs, explicit nudity or suggestive nudity.

    Try it out
  • Model gallery

    Explore our pre-built, ready-to-use image recognition models to suit your specific needs.

    Learn more