Implementation Guide
Browser-Based Architecture
AutheText-AI v2.0 runs completely in the browser. You do not need to call a backend API. The model is implemented using vanilla JavaScript and localized model weights.
No API Key Required. Runs locally in index.html.
javascript JavaScript Implementation Example
To implement detection on your own site, use the TF-IDF feature extractor mapping:
// 1. Load model_data.json
const response = await fetch('model_data.json');
const modelInfo = await response.json();
// 2. Compute TF-IDF features based on the vocabulary
function computeTfIdf(text, vocab, idf) {
// Return array of n-gram feature counts * idf
}
// 3. Sigmoid logic regression function
function predict(features, coef, intercept) {
let logOdds = intercept[0];
for (let i = 0; i < features.length; i++) {
logOdds += features[i] * coef[0][i];
}
return 1 / (1 + Math.exp(-logOdds)); // 0 = human, 1 = AI
}