Skip to main content

🆕📝🔬 Thai Text Toxicity Classification

🆕📝🔬 ระบบตรวจจับข้อความภาษาไทยที่เป็นToxic

Version Status

Welcome to iApp Thai Text Toxicity Classification API, an AI product developed by iApp Technology Co., Ltd. Our API provides powerful toxicity detection capabilities for Thai text, classifying content into toxic and non-toxic categories with high accuracy.

Try Demo

Visit our API Portal to test the Thai Text Toxicity Classification API with your own text.

Getting Started

  1. Prerequisites

    • An API key from iApp Technology
    • Thai text input
    • Internet connection
  2. Quick Start

    • Fast toxicity classification
    • High accuracy prediction
    • Simple REST API interface
  3. Key Features

    • Binary classification (Toxic, Non-toxic)
    • Confidence score for predictions
    • Fast response time
    • Easy integration
  4. Security & Compliance

    • GDPR and PDPA compliant
    • No data retention after processing
How to get API Key?

Please visit API Portal to view your existing API key or request a new one.

Example

Toxicity Analysis Request

    curl --location --request POST 'https://api.iapp.co.th/toxic-classification/predict?text=คณะนี้จบไปจะมีงานทำหรอ' \
--header 'apikey: {YOUR API KEY}'

Toxicity Analysis Response

Toxic

{
"label": "toxic",
"score": 0.7037630677223206,
"input_text": "พนันกับคาสิโนออนไลน์",
"duration": 0.02465963363647461,
"message": "success",
"status_code": 200
}

Non-Toxic

{
"label": "non_toxic",
"score": 0.8708284497261047,
"input_text": "เขาเป็นคนดี ชอบช่วยเหลือผู้อื่น",
"duration": 0.03416180610656738,
"message": "success",
"status_code": 200
}

Features & Capabilities

Core Features

  • Detects and classifies Thai text as either toxic or not toxic.
  • Employs advanced Natural Language Processing (NLP) techniques for accurate toxicity detection.
  • Enables proactive content monitoring and moderation on online platforms.

Supported Fields

  • Input: Thai text for toxicity classification.
  • Output: Classification result (toxic or not toxic).
  • Confidence score for the classification result.

Additional Capabilities

  • Easy integration with existing applications via RESTful API.
  • Designed for real-time and batch processing to suit various use cases.
  • Ideal for applications in social media moderation, online community management, and content safety enhancement.

API Reference

Endpoint

POST https://api.iapp.co.th/toxic-classification/predict

Query Parameters

NameTypeDescription
textStringInput Text in Thai language

Headers

NameTypeDescription
apikeyStringAPI Key

Code Examples

Python

import requests

url = "https://api.iapp.co.th/toxic-classification/predict?text={YOUR TEXT}"

payload = {}
headers = {
'apikey': '{YOUR API KEY}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


JavaScript

const axios = require('axios');

let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.iapp.co.th/toxic-classification/predict?text={YOUR TEXT}',
headers: {
'apikey': '{YOUR API KEY}'
}
};

axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});


PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/toxic-classification/predict?text={YOUR%20TEXT}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'apikey: {YOUR API KEY}'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Swift

var request = URLRequest(url: URL(string: "https://api.iapp.co.th/toxic-classification/predict?text={YOUR%20TEXT}")!,timeoutInterval: Double.infinity)
request.addValue("{YOUR API KEY}", forHTTPHeaderField: "apikey")

request.httpMethod = "POST"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}

task.resume()


Kotlin

val client = OkHttpClient()
val mediaType = "text/plain".toMediaType()
val body = "".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.iapp.co.th/toxic-classification/predict?text={YOUR TEXT}")
.post(body)
.addHeader("apikey", "{YOUR API KEY}")
.build()
val response = client.newCall(request).execute()

Java

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.iapp.co.th/toxic-classification/predict?text={YOUR TEXT}")
.method("POST", body)
.addHeader("apikey", "{YOUR API KEY}")
.build();
Response response = client.newCall(request).execute();

Dart

var headers = {
'apikey': '{YOUR API KEY}'
};
var request = http.Request('POST', Uri.parse('https://api.iapp.co.th/toxic-classification/predict?text={YOUR TEXT}'));

request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}


Pricing

AI API Service NameEndpointIC Per CharactersOn-Premise
Text Toxic Classification [v1.0]toxic-classification0.1 IC/400 CharactersContact