Hosted APIs

Bias analysis models on free hosted endpoints.

These models are intended for use in frontend applications. For Python data analysis and backends, you should try our PyPI package, which runs locally.

fairlyAspects (types-of bias)

Endpoint: https://t41xs75wejr14zht.us-east-1.aws.endpoints.huggingface.cloud

async function query(data) {
	const response = await fetch(
		"https://t41xs75wejr14zht.us-east-1.aws.endpoints.huggingface.cloud",
		{
			headers: { 
				"Accept" : "application/json",
				"Content-Type": "application/json" 
			},
			method: "POST",
			body: JSON.stringify(data),
		}
	);
	const result = await response.json();
	return result;
}

query({
    "inputs": "Your sentence for bias aspect classification",
    "parameters": {
        "top_k": 3,
        "function_to_apply": "sigmoid"
    }
}).then((response) => {
	console.log(JSON.stringify(response));
});

All parameters are optional

  • top_k: Number of classes and scores to return. Defaults to return all 11 classes and their scores.

  • function_to_apply: Activation function to use on the model outputs. Can be "sigmoid"(multi-label), "softmax" (mult-class), or None for raw logits. Defaults to "softmax".


Endpoint: https://e29pozks7ptdl5gw.us-east-1.aws.endpoints.huggingface.cloud

Similar architecture to Dbias.
async function query(data) {
	const response = await fetch(
		"https://e29pozks7ptdl5gw.us-east-1.aws.endpoints.huggingface.cloud",
		{
			headers: { 
				"Accept" : "application/json",
				"Content-Type": "application/json" 
			},
			method: "POST",
			body: JSON.stringify(data),
		}
	);
	const result = await response.json();
	return result;
}

query({
    "inputs": "Your sentence for binary bias classification",
    "parameters": {
        "top_k": 2,
        "function_to_apply": "sigmoid"
    }
}).then((response) => {
	console.log(JSON.stringify(response));
});

All parameters are optional

  • top_k: Can be 1 or 2, defaults to 1, meaning it just returns the highest probable class (Biased or Neutral).

  • function_to_apply: Activation function to use on the model outputs. Can be "sigmoid"(multi-label), "softmax" (mult-class), or None for raw logits. Defaults to "softmax".


Token Classification (of generalizations, unfairness, and stereotypes)

Endpoint: https://e29pozks7ptdl5gw.us-east-1.aws.endpoints.huggingface.cloud

GUS-Net Model
async function query(data) {
	const response = await fetch(
		"https://mo5fr3ll9qufbwuy.us-east-1.aws.endpoints.huggingface.cloud",
		{
			headers: { 
				"Accept" : "application/json",
				"Content-Type": "application/json" 
			},
			method: "POST",
			body: JSON.stringify(data),
		}
	);
	const result = await response.json();
	return result;
}

query({
    "inputs": "Hello world!",
    "parameters": {}
}).then((response) => {
	console.log(JSON.stringify(response));
});

*No params needed*

Example Response:

[
  {
    "token": "data",
    "labels": [
      "B-STEREO",
      "B-GEN"
    ]
  },
  {
    "token": "scientists",
    "labels": [
      "B-GEN",
      "I-GEN"
    ]
  },
  {
    "token": "are",
    "labels": [
      "I-STEREO"
    ]
  },
  {
    "token": "so",
    "labels": [
      "I-STEREO"
    ]
  },
  {
    "token": "smart",
    "labels": [
      "I-STEREO"
    ]
  }
]

Last updated