Get revscoring reverted prediction
POST | /service/lw/inference/v1/models/{wiki}-reverted:predict
|
---|
Get a score from the Revscoring Reverted model (previously hosted on ORES) for a given Wiki revision id.
Examples
curl
Anonymous access
# Get a score from the Revscoring Reverted model for the revision 12345 of Vietnamese Wikipedia.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/viwiki-reverted:predict -X POST -d '{"rev_id": 12345}' -H "Content-type: application/json"
Logged in access
# Get a score from the Revscoring Reverted model for the revision 12345 of Vietnamese Wikipedia.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/viwiki-reverted:predict -X POST -d '{"rev_id": 12345}' -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-type: application/json"
Python
# Python 3
# Get a score from the Revscoring Reverted model for the revision 12345 of Vietnamese Wikipedia.
import json
import requests
use_auth = False
inference_url = 'https://api.wikimedia.org/service/lw/inference/v1/models/viwiki-reverted: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": 12345 }
response = requests.post(inference_url, headers=headers, data=json.dumps(data))
print(response.json())
JavaScript
/*
Get a score from the Revscoring Reverted model for the revision 12345 of Vietnamese Wikipedia.
*/
const inferenceUrl = "https://api.wikimedia.org/service/lw/inference/v1/models/viwiki-reverted: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": 12345 };
fetch(inferenceUrl, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(inferenceData => console.log(inferenceData));
URI Parameters
wiki
required |
Wiki code:bnwiki (Bangla), elwiki (Greek), enwiktionary (English Wikitionary), glwiki (Galician), hrwiki (Croatian), idwiki (Indonesian), iswiki (Icelandic), tawiki (Tamil) or viwiki (Vietnamese).
|
POST Parameters
rev_id
required |
Wiki Revision id: integer related to a certain revision id for the Wiki set in the URI parameter. |
extended_output
|
Whether or not the response should include the extended output of the model (like the list of features used etc..). Either true or false. Default: false |
Responses
200 | Success: Revision id found. Returns a Revscoring score object.
Example
{
"viwiki": {
"models": {
"reverted": {
"version": "0.5.0"
}
},
"scores": {
"12345": {
"reverted": {
"score": {
"prediction": false,
"probability": {
"false": 0.9342944442219189,
"true": 0.06570555577808117
}
}
}
}
}
}
}
|
---|