47 lines
1.3 KiB
HTML
47 lines
1.3 KiB
HTML
|
<!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>
|