API
The Havelock API provides programmatic access to our orality detection models. Analyze any text and receive a score from 0 (highly literate) to 1 (highly oral), along with interpretive metadata. Free to use, no authentication required.
https://thestalwart-havelock-demo.hf.space
Submit text for analysis. Returns an event_id for retrieving results.
| Field | Type | Description |
|---|---|---|
| data | array | [text, include_sentences] - text is required, include_sentences is boolean |
Retrieve analysis results using the event_id from the POST request.
| Field | Type | Description |
|---|---|---|
| score | integer | Score from 0 (literate) to 100 (oral) |
| interpretation | object | Contains mode and description |
| word_count | integer | Number of words analyzed |
| sentences | array? | Per-sentence analysis (if include_sentences=true) |
# Step 1: Submit text for analysis
EVENT_ID=$(curl -sX POST https://thestalwart-havelock-demo.hf.space/gradio_api/call/analyze \
-H "Content-Type: application/json" \
-d '{"data": ["Tell me, O Muse, of that ingenious hero...", true]}' \
| jq -r '.event_id')
# Step 2: Get the result
curl -s "https://thestalwart-havelock-demo.hf.space/gradio_api/call/analyze/$EVENT_ID"
# Response (SSE format - parse the "data:" line)
data: {
"score": 76,
"interpretation": {
"mode": "oral",
"description": "Oral-dominant (speeches, podcasts, storytelling)"
},
"word_count": 22
}
import requests
import json
API_BASE = "https://thestalwart-havelock-demo.hf.space"
# Step 1: Submit text
resp = requests.post(
f"{API_BASE}/gradio_api/call/analyze",
json={"data": ["Your text here...", True]}
)
event_id = resp.json()["event_id"]
# Step 2: Get result
result = requests.get(f"{API_BASE}/gradio_api/call/analyze/{event_id}")
for line in result.text.split("\n"):
if line.startswith("data: "):
data = json.loads(line[6:])
print(f"Score: {data['score']}%")
print(f"Mode: {data['interpretation']['mode']}")
const API_BASE = "https://thestalwart-havelock-demo.hf.space";
// Step 1: Submit text
const submitResp = await fetch(`${API_BASE}/gradio_api/call/analyze`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ data: ["Your text here...", true] })
});
const { event_id } = await submitResp.json();
// Step 2: Get result (SSE stream)
const resultResp = await fetch(`${API_BASE}/gradio_api/call/analyze/${event_id}`);
const text = await resultResp.text();
const dataLine = text.split("\n").find(l => l.startsWith("data: "));
const data = JSON.parse(dataLine.slice(6));
console.log(`Score: ${data.score}%`);
console.log(`Mode: ${data.interpretation.mode}`);