IIS_2023_1/orlov_artem_lab_7/templates/index.html

47 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RNN Text Generation</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
#output {
margin-top: 20px;
}
</style>
</head>
<body>
<h1>RNN Text Generation</h1>
<label for="seed_text">Seed Text:</label>
<input type="text" id="seed_text" placeholder="Enter your seed text">
<button onclick="generateText()">Generate Text</button>
<div id="output"></div>
<script>
function generateText() {
const seedText = document.getElementById("seed_text").value;
fetch('http://127.0.0.1:5000/generate_text', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ seed_text: seedText }),
})
.then(response => response.json())
.then(data => {
document.getElementById("output").innerText = data.generated_text;
})
.catch(error => {
console.error('Error:', error);
});
}
</script>
</body>
</html>