1 minute read

Introduction

Brand recognition is a critical step in brand awareness analysis, brand protection, etc. Dfpipe is providing free model api service for brand recognition. Feel free to give it a try on our hugging face demo space: https://huggingface.co/spaces/dfpipe/eazyai

This free model api allows you to send an image url to our service, then the model will predict if the image contains a brand’s logo or product. [alt text]

If you have any questions or suggestions, feel free to post in our github open discussion page: https://github.com/dfpipe/easyai/issues

How to use the model

Step 1 - Prepare the input in json format

Code - Example of input

{
    "apikey": "dfpipe-eazymodel-jikhoh-jybmac-pYxsi9", 
    "data": [
        {"image": "image url (e.g. )"}, 
        {"image": "image url (e.g. )"}
    ], 
    "action": "infer", 
    "model_id": "brand-recognition-model-v3.0"
}

Step 2 - Call the model with the input

Option 1 - Call using HTTP request command Curl

curl -X POST https://api.dfpipe.com/eazyai \
-H "Content-Type: application/json" \
-d '{"apikey": "dfpipe-eazymodel-jikhoh-jybmac-pYxsi9", "data": [{"text": "This is a good product"}, {"text": "This is a bad product"}], "action": "infer", "model_id": "customer_review_sentiment_v1"}'

Option 2 - Call the model using python

import requests

url = "https://api.dfpipe.com/eazyai"
headers = {
    "Content-Type": "application/json"
}
payload = {
    "apikey": "dfpipe-eazymodel-jikhoh-jybmac-pYxsi9", 
    "data": [
        {"image": "image url (e.g. )"}, 
        {"image": "image url (e.g. )"}
    ], 
    "action": "infer", 
    "model_id": "brand-recognition-model-v3.0"
}

response = requests.post(url, json=payload, headers=headers)

# Print the response
print(response.status_code)
print(response.json())

Step 3 - Get the result

{
    "status_code": 200, 
    "body": {
        "results": [{"label":"balenciaga.com", "probability":1}], 
        "model_id": "customer_review_sentiment_v1", 
        "model_version": "1.0"
    }
}

Status code:

  1. 200: success
  2. 400: input argument error
  3. 500: internal server error

Tags:

Updated: