Introduction
AI Powered Visual Analysis Apis
Version: 3.0
Base URL - https://apis.paralleldots.com/v4
Installation
For setup and installation instruction, please visit our Github Page . Specifically, below are the links to each of our Client Libraries:
-C#
-Java
-Python
-PHP
-Ruby
-R
From Gem:
gem install paralleldots
From PyPI:
pip install paralleldots
From Source:
https://github.com/ParallelDots/ParallelDots-Python-API.git
python setup.py install
Use the JAR
paralleldots-1.0.2.jar
Path to JAR
path: target/paralleldots-1.0.2.jar
Dependencies
okhttp-3.10.0.jar
okio-1.14.0.jar
json-simple-1.1.jar
1.Create a composer.json file in your project's directory.
2.Write the following in the file:
{
"require": {
"paralleldots/apis": "*"
},
"minimum-stability": "dev"
}
3.Run the following command in the same directory (NOTE: You must have composer installed):"
composer install
Open the console in Visual Studio using the Tools > NuGet Package Manager > Package Manager Console command.
PM> Install-Package ParallelDots
library("devtools")
devtools::install(<path_to_locally_cloned_repo>)
Dependencies:
httr
jsonlite
Authentication
To authorize, use this code:
require 'paralleldots'
set_api_key("xxxxxxxxxxxxxxxxxxxxxxxx")
from paralleldots import set_api_key
set_api_key("xxxxxxxxxxxxxxxxxxxxxxxx")
NA
import paralleldots.ParallelDots;
ParallelDots pd = new ParallelDots("xxxxxxxxxxxxxxxxxxxxxxxx");
require(__DIR__ . '/vendor/paralleldots/apis/autoload.php');
# Setting your API key
set_api_key("xxxxxxxxxxxxxxxxxxxxxxxx");
# Import wrapper namespace
using ParallelDots
# Initialize instance of api class
paralleldots pd = new paralleldots("xxxxxxxxxxxxxxxxxxxxxxxx");
# Import paralleldots
library("ParallelDots")
# set your API Key
api_key="xxxxxxxxxxxxxxxxxxxxxxxx"
Make sure to replace
xxxxxxxxxxxxxxxxxxxxxxxx
with your API key.
ParallelDots Visual Intelligence APIs uses API keys to authenticate requests to the API. You can register for a new API key at our developer portal.
API Parameters
ParallelDots Visual Intelligence API accepts two parameters - Image Path or Image URL and api_key. Maximum Image size should not exceed 10 MB. Valid image formats are .jpg, .jpeg, .png, .bmp and .tiff
Either path to image file or an image url is mandatory, do not send both of them simultaneously.
Facial Emotion
POST
Summary: Facial Emotion API can detect different emotion types from facial expressions in a potrait image.
Description: This API can be used to monitor emotions associated with visual content shared on social media or photo sharing apps or build interactive video chat applications.
require 'paralleldots'
# when sending a image file
path = "<path_to_image>"
puts( facial_emotion( path ) )
# when sending a image url
url = "<url_to_image>"
puts( facial_emotion_url( url ) )
import paralleldots
# when sending a image file
path = "<path_to_image>"
print( paralleldots.facial_emotion( path ) )
# when sending a image url
url = "<url_to_image>"
print( paralleldots.facial_emotion_url( url ) )
#or
import requests
# When sending a image file.
facial_emotion = requests.post( "https://apis.paralleldots.com/v4/facial_emotion", data={ "api_key": api_key } ,files={"file": open("<path_to_image>","rb")}).text
# When sending a image url
facial_emotion = requests.post( "https://apis.paralleldots.com/v4/facial_emotion", data={ "api_key": api_key ,"url":"<url_to_image>"}).text
To sending a image file.
curl -X POST -F 'file=@<path_to_image>' -F 'api_key=xxxxxxxxxxxxxxxxxxxxxxxxxxx' https://apis.paralleldots.com/v4/facial_emotion
when sending a image url.
curl -X POST -F 'url=<url_to_image>' -F 'api_key=xxxxxxxxxxxxxxxxxxxxxxxxxxx' https://apis.paralleldots.com/v4/facial_emotion
import com.paralleldots.paralleldots.App;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
App pd = new App("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// when sending a image file
String path_to_image="<path_to_image>"
String facial_emotion = pd.facial_emotion(path_to_image);
System.out.println(facial_emotion);
// when sending a image url
String facial_emotion_url = pd.facial_emotion_url(<url_to_image>);
System.out.println(facial_emotion_url);
<?php
require(__DIR__ . '/vendor/paralleldots/apis/autoload.php');
set_api_key("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
# when sending a image file
$path_to_image = "<path_to_image>";
echo facial_emotion($path_to_image);
# when sending a image url
$url_to_image = "<url_to_image>";
echo facial_emotion_url($url_to_image);
?>
using ParallelDots
// when sending a image file
String path_to_image = @"<path_to_image>";
Console.WriteLine("facial emotion");
String facial_emotion = pd.facial_emotion(path_to_image);
Console.WriteLine(facial_emotion);
// when sending a image url
String facial_emotion_url = pd.facial_emotion_url(<url_to_image>);
Console.WriteLine(facial_emotion_url);
library("ParallelDots")
url="https://apis.paralleldots.com/v4/facial_emotion"
image_url="<image url>" #must be https
result<-facial_emotion(url,image_url,api_key)
The above command returns JSON structured like this:
{
"facial_emotion": [
{
"score": 0.46334898471832275,
"tag": "Angry"
},
{
"score": 0.23679578304290771,
"tag": "Neutral"
},
{
"score": 0.09110680967569351,
"tag": "Sad"
},
{
"score": 0.0540882833302021,
"tag": "Fear"
},
{
"score": 0.05155337601900101,
"tag": "Surprise"
},
{
"score": 0.05155337601900101,
"tag": "Happy"
},
{
"score": 0.05155337601900101,
"tag": "Disgust"
}
],
}
HTTP Request
Endpoint https://apis.paralleldots.com/v4/facial_emotion
***POST*** /facial_emotion
Parameters
Either file or url is mandatory , do not send both parameters.
Name | Located in | Description | Required | Type |
---|---|---|---|---|
url | query | Pass url of image file | Yes if file not provided | string |
file | query | Pass a image file | Yes if url not provided | file |
api_key | query | Apikey | Yes | string |
Responses
Name | Description | Type |
---|---|---|
facial_emotion | Contains all the tags and their corresponding score | array |
tag | Name of the emotion i.e (Angry,Disgust,Fear,Happy,Sad,Surprise,Neutral) | string |
score | The confidence score of the emotion in the image. It lies between 0 to 1 . Higher score states the higher confidence score of the output. | float |
HTTP Error Codes
Code | Text | Description |
---|---|---|
200 | OK | Successful response |
304 | Not Modified | There was no new data to return. |
500 | Internal Server Error | Backend Error. We will investigate the issue and ensure it will be fixed as a priority |
400 | Bad Request | No Input image uploaded or Input URL given. |
401 | Unauthorized | Invalid Credentials. Please provide valid API key |
403 | Forbidden | Visual API Daily/Monthy Limit Exceeded. Please upgrade your account from your user dashboard at https://user.apis.paralleldots.com/user_dashboard |
429 | Too Many Requests | Too Many Requests. Please try after sometime. |
406 | Not Acceptable | Invalid Format. Parameter url should be string |
Image Labels
POST
Summary: Find labels of an image
Description: Image recognition API finds the label(s) (names) of objects in the image along with its probability score. Image Recognition is beneficial to build visual search capability in your application letting you create a compelling discovery engine for your items.
require 'paralleldots'
# when sending a image file
path = "<path_to_image>"
puts( object_recognizer( path ) )
# when sending a image url
url = "url_to_path"
puts( object_recognizer_url( url ) )
import paralleldots
# when sending a image file
path = "<path_to_image>"
print( paralleldots.object_recognizer( path ) )
# when sending a image url
url = "<url_to_image>"
print( paralleldots.object_recognizer_url( url ))
#or
import requests
#when sending a image file
data = requests.post( "https://apis.paralleldots.com/v4/object_recognizer", data={ "api_key": api_key } ,files={"file": open("<path_to_image>","rb")}).text
# When sending a url image
data = requests.post( "https://apis.paralleldots.com/v4/object_recognizer", data={ "api_key": api_key ,"url":"<url_to_image>"}).text
To send a image file.
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' {"type":"formData"} -F "file=@<path_to_image>" -F "api_key=xxxxxxxxxxxxxxxxxxxxxxxx" 'https://apis.paralleldots.com/v4/object_recognizer'
To send a image url.
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: amData"} -F "url=<url_to_image>" -F "api_key=xxxxxxxxxxxxxxxxxxxxxxxx" 'https://apis.paralleldots.com/v4/object_recognizer'
import com.paralleldots.paralleldots.App;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
App pd = new App("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// when sending a image file
String path_to_image="<path_to_image>"
String object_recognizer = pd.object_recognizer(path_to_image);
System.out.println(object_recognizer);
// when sending a image url
String object_recognizer_url = pd.object_recognizer_url(<url_to_image>);
System.out.println(object_recognizer_url);
<?php
require(__DIR__ . '/vendor/paralleldots/apis/autoload.php');
set_api_key("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// when sending a image file
$path_to_image = "<path_to_image>";
echo object_recognizer($path_to_image);
// when sending a image url
$url_to_image = "<url_to_image>";
echo object_recognizer_url($url_to_image);
?>
using ParallelDots
// when sending a image file
String path_to_image = @"<path_to_image>";
Console.WriteLine("object_recognizer");
String object_recognizer = pd.object_recognizer(path_to_image);
Console.WriteLine(object_recognizer);
// when sending a image url
String object_recognizer_url = pd.object_recognizer_url(<url_to_image>);
Console.WriteLine(object_recognizer_url);
library("ParallelDots")
url="https://apis.paralleldots.com/v4/object_recognizer"
image_url="<image url>" #must be https
result<-object_recognizer(url,image_url,api_key)
The above command returns JSON structured like this:
{
"output": [
{
"tag": "Fashion",
"score": 0.36841973662376404
},
{
"tag": "Clothing",
"score": 0.2704277038574219
},
{
"tag": "Photo shoot",
"score": 0.21180585026741028
},
{
"tag": "Dress",
"score": 0.19927018880844116
},
{
"tag": "Photograph",
"score": 0.19799776375293732
},
{
"tag": "Person",
"score": 0.18744145333766937
},
{
"tag": "Model",
"score": 0.16371771693229675
},
{
"tag": "Beauty",
"score": 0.16217313706874847
},
{
"tag": "Woman",
"score": 0.15185585618019104
},
{
"tag": "Art",
"score": 0.11858072131872177
}
],
}
HTTP Request
Endpoint https://apis.paralleldots.com/v4/object_recognizer
***POST*** /object_recognizer
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
url | query | Pass url of image file | Yes if file not provided | string |
file | query | Pass a image file | Yes if url not provided | file |
api_key | query | Apikey | Yes | string |
Responses
Name | Description | Type |
---|---|---|
output | Contains all the tags and their corresponding score | array |
tag | Name of the emotion i.e (Angry,Disgust,Fear,Happy,Sad,Surprise,Neutral) | string |
score | The confidence score of the emotion in the image. It lies between 0 to 1 . Higher score states the higher confidence score of the output. | float |
HTTP Error Codes
Code | Text | Description |
---|---|---|
200 | OK | Successful response |
304 | Not Modified | There was no new data to return. |
500 | Internal Server Error | Backend Error. We will investigate the issue and ensure it will be fixed as a priority |
400 | Bad Request | No Input image uploaded or Input URL given. |
401 | Unauthorized | Invalid Credentials. Please provide valid API key |
403 | Forbidden | Visual API Daily/Monthy Limit Exceeded. Please upgrade your account from your user dashboard at https://user.apis.paralleldots.com/user_dashboard |
429 | Too Many Requests | Too Many Requests. Please try after sometime. |
406 | Not Acceptable | Invalid Format. Parameter url should be string |
Errors
The Kittn API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The kitten requested is hidden for administrators only. |
404 | Not Found -- The specified kitten could not be found. |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The kitten requested has been removed from our servers. |
418 | I'm a teapot. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |