ClassificationApi
All URIs are relative to https://app.coactive.ai
classify_assets
ClassificationResponse classify_assets(classification_request)
Upload assets to classify based on embedding id using either public path to assets, or embedding vectors
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.classification_request import ClassificationRequest
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.classification_response import ClassificationResponse
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
classification_request = ClassificationRequest(
embedding_id="b78a6e5f-5434-46c4-9e4f-ded092147584",
concept_id="428e52cd-7ceb-490c-ae3f-0848c82d8c97",
embedding_vectors=[
ClassificationEmbeddingVectorRequest(
embedding_vector=[0.15,1.32,0.19],
external_id="some-id",
),
],
paths=["s3://your-s3-bucket/path/to/image.jpg","https://example.com/path/to/image.jpg"],
)
threshold = 0.5 # (optional) if omitted the server will use the default value of 0.5
# example passing only required values which don't have defaults set
try:
# Classify assets by embedding id
api_response = api_instance.classify_assets(classification_request)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Classify assets by embedding id
api_response = api_instance.classify_assets(classification_request, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
classification_request |
ClassificationRequest |
|
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.5 |
Return type
ClassificationResponse
Authorization
HTTPBearer
- Content-Type: application/json
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the classifications |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
classify_assets_custom_model
CustomClassificationResponse classify_assets_custom_model(model_name, embedding_id, files)
Upload list of assets to classify based on embedding id and a custom model
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.custom_classification_response import CustomClassificationResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
model_name = "my_model_name.pkl"
embedding_id = "b78a6e5f-5434-46c4-9e4f-ded092147584"
files = [
open('/path/to/file', 'rb'),
]
threshold = 0.5 # (optional) if omitted the server will use the default value of 0.5
# example passing only required values which don't have defaults set
try:
# Classify list of assets by embedding id and a custom model
api_response = api_instance.classify_assets_custom_model(model_name, embedding_id, files)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_custom_model: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Classify list of assets by embedding id and a custom model
api_response = api_instance.classify_assets_custom_model(model_name, embedding_id, files, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_custom_model: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
model_name |
str |
The name of the model to use |
|
embedding_id |
str |
The unique identifier for the embedding |
|
files |
[file_type] |
List of assets to classify |
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.5 |
Return type
CustomClassificationResponse
Authorization
HTTPBearer
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the classifications |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
classify_assets_file
ClassificationResponse classify_assets_file(embedding_id, files)
Upload assets to classify based on embedding id using one of image file, , csv of paths or a csv embedding vectors
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.classification_response import ClassificationResponse
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
embedding_id = "b78a6e5f-5434-46c4-9e4f-ded092147584"
files = [
open('/path/to/file', 'rb'),
]
threshold = 0.5 # (optional) if omitted the server will use the default value of 0.5
# example passing only required values which don't have defaults set
try:
# Classify assets by embedding id
api_response = api_instance.classify_assets_file(embedding_id, files)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_file: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Classify assets by embedding id
api_response = api_instance.classify_assets_file(embedding_id, files, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_file: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
embedding_id |
str |
The unique identifier for the embedding |
|
files |
[file_type] |
1 of 3 types of files are accepted: 1: CSV file with a list of paths to assets to classify, 'path' is required header2: CSV file with embedding vectors, 'external_id' and 'embedding_vector' are required headers3: Image file (jpg, png or webp) |
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.5 |
Return type
ClassificationResponse
Authorization
HTTPBearer
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the classifications |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
classify_assets_for_visual_safety
VisualSafetyClassificationResponse classify_assets_for_visual_safety(visual_safety_classification_request)
Classify a list of assets to determine whether they meet visual safety standards
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.visual_safety_classification_request import VisualSafetyClassificationRequest
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.visual_safety_classification_response import VisualSafetyClassificationResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
visual_safety_classification_request = VisualSafetyClassificationRequest(
embedding_vectors=[
ClassificationEmbeddingVectorRequest(
embedding_vector=[0.15,1.32,0.19],
external_id="some-id",
),
],
paths=["s3://your-s3-bucket/path/to/image.jpg","https://example.com/path/to/image.jpg"],
)
threshold = 0.47 # (optional) if omitted the server will use the default value of 0.47
# example passing only required values which don't have defaults set
try:
# Classify a list of assets for visual safety
api_response = api_instance.classify_assets_for_visual_safety(visual_safety_classification_request)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_for_visual_safety: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Classify a list of assets for visual safety
api_response = api_instance.classify_assets_for_visual_safety(visual_safety_classification_request, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_for_visual_safety: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
visual_safety_classification_request |
VisualSafetyClassificationRequest |
|
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.47 |
Return type
VisualSafetyClassificationResponse
Authorization
HTTPBearer
- Content-Type: application/json
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the visual safety classifications |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
classify_assets_for_visual_safety_file
VisualSafetyClassificationResponse classify_assets_for_visual_safety_file(files)
Classify a list of assets to determine whether they meet visual safety standards (jpg, png or webp)
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.visual_safety_classification_response import VisualSafetyClassificationResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
files = [
open('/path/to/file', 'rb'),
]
threshold = 0.47 # (optional) if omitted the server will use the default value of 0.47
# example passing only required values which don't have defaults set
try:
# Classify a list of assets for visual safety
api_response = api_instance.classify_assets_for_visual_safety_file(files)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_for_visual_safety_file: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Classify a list of assets for visual safety
api_response = api_instance.classify_assets_for_visual_safety_file(files, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->classify_assets_for_visual_safety_file: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
files |
[file_type] |
List of assets to classify for visual safety |
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.47 |
Return type
VisualSafetyClassificationResponse
Authorization
HTTPBearer
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the visual safety classifications |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
detect_text
TextDetectionResponse detect_text(text_detection_request)
Classify a list of assets to determine whether or not they contain text
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.text_detection_response import TextDetectionResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.text_detection_request import TextDetectionRequest
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
text_detection_request = TextDetectionRequest(
embedding_vectors=[
ClassificationEmbeddingVectorRequest(
embedding_vector=[0.15,1.32,0.19],
external_id="some-id",
),
],
paths=["s3://your-s3-bucket/path/to/image.jpg","https://example.com/path/to/image.jpg"],
)
threshold = 0.5 # (optional) if omitted the server will use the default value of 0.5
# example passing only required values which don't have defaults set
try:
# Detect if there is text in a list of assets.
api_response = api_instance.detect_text(text_detection_request)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->detect_text: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Detect if there is text in a list of assets.
api_response = api_instance.detect_text(text_detection_request, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->detect_text: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
text_detection_request |
TextDetectionRequest |
|
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.5 |
Return type
TextDetectionResponse
Authorization
HTTPBearer
- Content-Type: application/json
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the text detection classification |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
detect_text_file
TextDetectionResponse detect_text_file(files)
Classify a list of assets to determine whether or not they contain text
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import ClassificationApi
from coactive.model.text_detection_response import TextDetectionResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ClassificationApi(api_client)
files = [
open('/path/to/file', 'rb'),
]
threshold = 0.5 # (optional) if omitted the server will use the default value of 0.5
# example passing only required values which don't have defaults set
try:
# Detect if there is text in a list of assets.
api_response = api_instance.detect_text_file(files)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->detect_text_file: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Detect if there is text in a list of assets.
api_response = api_instance.detect_text_file(files, threshold=threshold)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling ClassificationApi->detect_text_file: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
files |
[file_type] |
List of assets to classify for visual safety |
|
threshold |
float, none_type |
Threshold above which classification is positive |
[optional] if omitted the server will use the default value of 0.5 |
Return type
TextDetectionResponse
Authorization
HTTPBearer
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Result of the text detection classification |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]