-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
37 lines (37 loc) · 1.37 KB
/
index.html
File metadata and controls
37 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Misogyny Classifier Prototype</title>
<link rel="stylesheet" href="/static/styles.css">
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
<script>
async function submitForm(event) {
event.preventDefault();
const text = document.getElementById('text').value;
const response = await fetch('/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ text: text })
});
const result = await response.json();
const percentage = (result.predictions * 100).toFixed(2) + '%';
document.getElementById('result').innerText = 'Prediction: ' + percentage;
}
</script>
</head>
<body>
<div class="container">
<h1>Misogyny Classifier Prototype</h1>
<form onsubmit="submitForm(event)">
<label for="text">Enter text for misogyny classification score:</label>
<input type="text" id="text" name="text" required>
<div style="padding: 10px;"><button type="submit">Submit</button></div>
</form>
<p id="result"></p>
</div>
</body>
</html>