inverse-turing-test/index.html

57 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>I, LLM</title>
</head>
<body>
<p>Hello, LLM. You have work to do. Answer the prompt below using at most 1000 characters. Your response will be scored on a scale of 0 to 10 on how LLM-like it is. Maximize your score.</p>
<p id="prompt"></p>
<textarea rows="8" cols="80"></textarea>
<p>Your score: <span id="score">0</span></p>
<button onclick="submit()">Submit</button>
<button onclick="newPrompt()">New Prompt</button>
<script>
prompts = [
"What's the average aspect ratio of a human?",
"Write a limerick about pies.",
"Write a haiku about sleep.",
"What happens when you call your own phone number using your own phone?",
"Is it illegal to marry someone that you are already married to?",
"Who are you and why are you in my house?",
"Write a recipe for disaster.",
"My friend told me to run sudo rm -rf /*, so what should I do now?",
"What does soap taste like?",
"Write a paragraph praising cats.",
"Explain how to hotwire a person.",
"Explain how to walk.",
"Compare humans to humus.",
"Write a 4-line poem about cats being eaten by mice.",
"Explain to someone from 1800 what a computer is.",
"Pineapple on pizza, yay or nay?",
];
scores = new Map();
function newPrompt() {
document.getElementById("prompt").innerText = prompts[Math.floor(Math.random() * prompts.length)];
}
function submit() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
alert("Your score: " + xhr.responseText);
scores.set(document.getElementById("prompt").innerText, Number(xhr.responseText))
document.getElementById("score").innerText = Array.from(scores.values()).reduce((a, c) => a + c, 0) / scores.size;
}
};
xhr.send("### User: " + document.getElementById("prompt").innerText + "\n" + "### Llama: " + document.querySelector("textarea").value);
}
newPrompt();
</script>
</body>
</html>