patrickbdevaney
upload of demo to hf spaces
35a837e
raw
history blame
1.17 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sentiment Analysis</title>
</head>
<body>
<h1>Sentiment Analysis</h1>
<form id="commentForm">
<label for="comment">Enter your comment:</label><br>
<textarea id="comment" name="comment" rows="4" cols="50"></textarea><br><br>
<input type="submit" value="Analyze Sentiment">
</form>
<p id="result"></p>
<script>
document.getElementById('commentForm').addEventListener('submit', function(event) {
event.preventDefault();
const comment = document.getElementById('comment').value;
fetch('/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ comment: comment }),
})
.then(response => response.json())
.then(data => {
document.getElementById('result').innerText = 'Sentiment: ' + data.sentiment;
});
});
</script>
</body>
</html>