81 lines
2.0 KiB
HTML
81 lines
2.0 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: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||
|
text-align: center;
|
||
|
margin: 50px;
|
||
|
background-color: #f5f5f5;
|
||
|
}
|
||
|
|
||
|
h1 {
|
||
|
color: #333;
|
||
|
}
|
||
|
|
||
|
label {
|
||
|
display: block;
|
||
|
margin-top: 20px;
|
||
|
font-size: 18px;
|
||
|
}
|
||
|
|
||
|
#seed_text {
|
||
|
padding: 8px;
|
||
|
font-size: 16px;
|
||
|
width: 300px;
|
||
|
}
|
||
|
|
||
|
button {
|
||
|
background-color: #4caf50;
|
||
|
color: white;
|
||
|
padding: 10px 20px;
|
||
|
font-size: 16px;
|
||
|
border: none;
|
||
|
cursor: pointer;
|
||
|
transition: background-color 0.3s;
|
||
|
}
|
||
|
|
||
|
button:hover {
|
||
|
background-color: #45a049;
|
||
|
}
|
||
|
|
||
|
#output {
|
||
|
margin-top: 20px;
|
||
|
font-size: 18px;
|
||
|
white-space: pre-wrap;
|
||
|
}
|
||
|
</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>
|