Get reverted risk multilingual prediction
POST | /service/lw/inference/v1/models/revertrisk-multilingual:predict
|
---|
The goal of this model is to detect revisions that might be reverted independently if they were made in good faith or with the intention of creating damage. Check the model card for more info.
Examples
curl
Anonymous access
# Get the revert risk probability for the edit on English Wikipedia identified by the revision id 123456.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict -X POST -d '{"rev_id": 123456, "lang": "en"}' -H "Content-type: application/json"
Logged in access
# Get the revert risk probability for the edit on English Wikipedia identified by the revision id 123456.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict -X POST -d '{"rev_id": 123456, "lang": "en"}' -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-type: application/json"
Python
# Python 3
# Get the revert risk probability for the edit on English Wikipedia identified by the revision id 123456.
import json
import requests
use_auth = False
inference_url = 'https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict'
if use_auth:
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)',
'Content-type': 'application/json'
}
else:
headers = {}
data = {"rev_id": 123456, "lang": "en"}
response = requests.post(inference_url, headers=headers, data=json.dumps(data))
print(response.json())
JavaScript
/*
Get the revert risk probability for the edit on English Wikipedia identified by the revision id 123456.
*/
const inferenceUrl = "https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict";
const accessToken = "YOUR_ACCESS_TOKEN";
const appName = "YOUR_APP_NAME";
const email = "YOUR_EMAIL_OR_CONTACT_PAGE";
let headers = new Headers({
"Content-Type": "application/json",
"Authorization": "Bearer " + accessToken,
"Api-User-Agent": appName + " ( " + email + " )"
});
let data = {"rev_id": 123456, "lang": "en"};
fetch(inferenceUrl, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(inferenceData => console.log(inferenceData));
POST Parameters
lang
required |
A string representing the language code related to the target wiki. Example: "en" for English Wikipedia.
Currently 47 languages are supported: |
rev_id
required |
The revision id for the wiki identified by the lang parameter.
|
Responses
200 | Success: Returns a Revert risk score object.
Example
{
"model_name":"revertrisk-multilingual",
"model_version":"3",
"wiki_db":"enwiki",
"revision_id":123456,
"output":{
"prediction":false,
"probabilities":{
"true":0.3058536847305622,
"false":0.6941463152694378
}
}
}
|
---|