Create static / index.html
Browse files- static / index.html +98 -0
static / index.html
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>FastAPI App</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
margin: 0;
|
11 |
+
padding: 0;
|
12 |
+
display: flex;
|
13 |
+
justify-content: center;
|
14 |
+
align-items: center;
|
15 |
+
height: 100vh;
|
16 |
+
background-color: #f0f0f0;
|
17 |
+
}
|
18 |
+
|
19 |
+
.container {
|
20 |
+
text-align: center;
|
21 |
+
}
|
22 |
+
|
23 |
+
h1 {
|
24 |
+
margin-bottom: 20px;
|
25 |
+
}
|
26 |
+
|
27 |
+
input {
|
28 |
+
padding: 10px;
|
29 |
+
margin-right: 10px;
|
30 |
+
}
|
31 |
+
|
32 |
+
button {
|
33 |
+
padding: 10px 20px;
|
34 |
+
background-color: #007bff;
|
35 |
+
color: #fff;
|
36 |
+
border: none;
|
37 |
+
cursor: pointer;
|
38 |
+
}
|
39 |
+
|
40 |
+
button:hover {
|
41 |
+
background-color: #0056b3;
|
42 |
+
}
|
43 |
+
</style>
|
44 |
+
</head>
|
45 |
+
<body>
|
46 |
+
<div class="container">
|
47 |
+
<h1>FastAPI App</h1>
|
48 |
+
<div>
|
49 |
+
<label for="prompt">Enter text:</label>
|
50 |
+
<input type="text" id="prompt" name="prompt">
|
51 |
+
</div>
|
52 |
+
<br>
|
53 |
+
<div>
|
54 |
+
<button onclick="generatePrompts()">Generate Prompts</button>
|
55 |
+
</div>
|
56 |
+
<br>
|
57 |
+
<div>
|
58 |
+
<label for="inputs">Enter inputs:</label>
|
59 |
+
<input type="text" id="inputs" name="inputs">
|
60 |
+
<label for="noise_level">Noise Level:</label>
|
61 |
+
<input type="number" id="noise_level" name="noise_level" step="0.01" min="0" max="1" value="0">
|
62 |
+
</div>
|
63 |
+
<br>
|
64 |
+
<div>
|
65 |
+
<button onclick="sendInputs()">Send Inputs</button>
|
66 |
+
</div>
|
67 |
+
<br>
|
68 |
+
<div id="output"></div>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<script>
|
72 |
+
function generatePrompts() {
|
73 |
+
const prompt = document.getElementById("prompt").value;
|
74 |
+
fetch(`/generate_prompts?prompt_text=${encodeURIComponent(prompt)}`)
|
75 |
+
.then(response => response.text())
|
76 |
+
.then(data => {
|
77 |
+
document.getElementById("output").innerHTML = data;
|
78 |
+
})
|
79 |
+
.catch(error => {
|
80 |
+
console.error('Error:', error);
|
81 |
+
});
|
82 |
+
}
|
83 |
+
|
84 |
+
function sendInputs() {
|
85 |
+
const inputs = document.getElementById("inputs").value;
|
86 |
+
const noiseLevel = document.getElementById("noise_level").value;
|
87 |
+
fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}`)
|
88 |
+
.then(response => response.text())
|
89 |
+
.then(data => {
|
90 |
+
document.getElementById("output").innerHTML = data;
|
91 |
+
})
|
92 |
+
.catch(error => {
|
93 |
+
console.error('Error:', error);
|
94 |
+
});
|
95 |
+
}
|
96 |
+
</script>
|
97 |
+
</body>
|
98 |
+
</html>
|