Predicting a synthesised image You can use this endpoint to detect if an image has been artificially generated.
Once an image has been submitted, our machine learning model will predict the likelihood of the provided image being artificially generated by other models such as Stable Diffusion or Midjourney.
In our testing, each model performed at >80% accuracy in detecting whether an image was a deepfake within their category. The following models are available for use:
Supported file formats include: .PNG
, .JPEG
& .JPG
Extremely bright or vibrant images may affect accuracy during prediction. Additionally, predictions are indications and shouldn't be considered a definitive answer.
Predicting a synthesised image
POST
/api-deepfake-detection
Detect whether an image has been artificially generated.
Headers
Body
Request
cURL Node.js Ruby Python
Copy curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"imageUrl": "YOUR_IMAGE_URL/image.jpg",
"modelName": "MODEL_NAME",
"token": "YOUR_ENDPOINT_TOKEN"
}' \
https://enterprise.personr.co/api/1.1/wf/api-deepfake-detection
Copy const axios = require ( 'axios' );
const url = 'https://enterprise.personr.co/api/1.1/wf/api-deepfake-detection' ;
const token = 'YOUR_BEARER_TOKEN' ;
const endpointToken = 'YOUR_ENDPOINT_TOKEN' ;
const data = {
imageUrl : 'YOUR_IMAGE_URL/image.jpg' ,
modelName : 'Personr_DF_5M' ,
token : endpointToken
};
const config = {
headers : {
'Content-Type' : 'application/json' ,
'Authorization' : `Bearer ${ token } `
}
};
axios .post (url , data , config)
.then (response => {
console .log ( response .data);
})
.catch (error => {
console .error ( 'Error:' , error);
});
Copy require 'net/http'
require 'uri'
require 'json'
url = URI . parse( 'https://enterprise.personr.co/api/1.1/wf/api-deepfake-detection' )
token = 'YOUR_BEARER_TOKEN'
endpoint_token = 'YOUR_ENDPOINT_TOKEN'
data = {
imageUrl: 'YOUR_IMAGE_URL/image.jpg' ,
modelName: 'Personr_DF_5M' ,
token: endpoint_token
}
http = Net :: HTTP . new (url . host , url . port)
http . use_ssl = true
request = Net :: HTTP :: Post . new (url . path)
request[ 'Content-Type' ] = 'application/json'
request[ 'Authorization' ] = "Bearer #{token} "
request . body = data . to_json
response = http . request(request)
puts response . body
Copy import requests
url = 'https://enterprise.personr.co/api/1.1/wf/api-deepfake-detection'
token = 'YOUR_BEARER_TOKEN'
endpoint_token = 'YOUR_ENDPOINT_TOKEN'
data = {
'imageUrl' : 'hYOUR_IMAGE_URL/image.jpg' ,
'modelName' : 'Personr_DF_5M' ,
'token' : endpoint_token
}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Bearer {} ' . format (token)
}
response = requests . post (url, json = data, headers = headers)
if response . status_code == 200 :
print (response. json ())
else :
print ( 'Error:' , response.text)
Response
200 400 401
Copy {
"status" : "success" ,
"response" : {
"result" : "Artificial" ,
"labels" : [
"Artificial" ,
"Genuine"
] ,
"confidence" : [
0.875041127204895 ,
0.12495886534452438
]
}
}
Copy {
"statusCode" : 400 ,
"message" : "Error: incorrect modelName provided"
}
Copy {
"error_class" : "Unauthorized" ,
"args" : {
"code" : "1709700303639x0000000000000"
} ,
"message" : null ,
"translation" : "Invalid or expired token: ABC123"
Last updated 2 months ago