-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhome.html
208 lines (199 loc) · 6.75 KB
/
home.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VISION</title>
<!-- <link rel="stylesheet" href="style.css"> -->
</head>
<body>
<style>
@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Jost';
color: white;
}
body{
background-color: rgb(25, 24, 24);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
gap: 1em;
}
main{
display: flex;
gap: 2em;
}
.controls{
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
background-color: rgb(55, 55, 55);
gap: 4em;
padding: 2em;
border-radius: 10px;
}
.controls .row{
display: flex;
align-items: flex-start;
justify-content: flex-start;
gap: 3em;
width: 100%;
}
.cnt-head{
align-self: center;
}
.controls .row .col{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
}
.slider{
width: 100%;
}
.radio{
color: white;
}
.bar{
width: 100vw;
height: 10px;
position: absolute;
bottom: 0;
left: 0;
background: linear-gradient(90deg, #F00 0%, #FF00F5 25.27%, #6100FF 50.07%, #0500FF 74.22%, #00D1FF 100%);
}
header{
display: flex;
justify-content: space-between;
align-items: center;
padding: 1em 3em;
width: 100vw;
position: absolute;
top: 0;
left: 0;
}
header nav ul{
display: flex;
list-style-type: none;
gap: 3em;
}
header nav ul li a{
text-decoration: none;
}
header nav ul li a:hover{
color: yellow;
}
</style>
<header>
<h1>VISION</h1>
<nav>
<ul>
<li><a href="/home">Daltonization</a></li>
<li><a href="/cataract">Cataract-Prediction</a></li>
</ul>
</nav>
</header>
<main>
<!-- <img id="video_feed" width="640" height="480"> -->
<img id="video_feed" src="/video_feed" width="640" height="480">
<div class="controls">
<h2 class="cnt-head">Controls</h2>
<div class="row">
<label for="gamma">Gamma: </label>
<input name="gamma" type="range" min="100" max="1000" width="400" height="20" class="slider" id="gamma">
</div>
<div class="row">
<label for="mode">Choose mode: </label>
<div class="col">
<input type="radio" class="radio mode" id="mode" name="mode" value="Normal" checked>
<p>Normal</p>
</div>
<div class="col">
<input type="radio" class="radio mode" id="mode" name="mode" value="Simulated">
<p>Simulated</p>
</div>
<div class="col">
<input type="radio" class="radio mode" id="mode" name="mode" value="Daltonized">
<p>Daltonized</p>
</div>
</div>
<div class="row">
<label for="mode">Choose Type: </label>
<div class="col">
<input type="radio" class="radio type" id="type" name="type" value="d" checked>
<p>Deuteranopia</p>
</div>
<div class="col">
<input type="radio" class="radio type" id="type" name="type" value="t">
<p>Tritnopia</p>
</div>
<div class="col">
<input type="radio" class="radio type" id="type" name="type" value="p">
<p>Protonopia</p>
</div>
</div>
</div>
</main>
<div class="bar"></div>
<script defer>
const input = document.getElementById('gamma')
const radioM = document.querySelectorAll(".mode");
const radioT = document.querySelectorAll(".type");
input.addEventListener('change', ()=>{
console.log(input.value);
fetch('http://127.0.0.1:8000/gamma', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': "*"
},
body: JSON.stringify({text: input.value}),
})
.then(res => res.json()).then(res=>{
console.log("hello " + res.reply);
})
.catch(error => {console.error('Error:', error); });
} );
radioT.forEach(e => e.addEventListener('change', ()=>{
const type = document.querySelector('input[name="type"]:checked');
console.log(type.defaultValue);
fetch('http://127.0.0.1:8000/type', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': "*"
},
body: JSON.stringify({text: type.defaultValue}),
})
.then(res => res.json()).then(res=>{
console.log("hello " + res.reply);
})
.catch(error => {console.error('Error:', error); });
}))
radioM.forEach(e => e.addEventListener('change', ()=>{
const mode = document.querySelector('input[name="mode"]:checked');
console.log(type.defaultValue);
fetch('http://127.0.0.1:8000/mode', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': "*"
},
body: JSON.stringify({text: mode.defaultValue}),
})
.then(res => res.json()).then(res=>{
console.log("hello " + res.reply);
})
.catch(error => {console.error('Error:', error); });
}))
</script>
</body>
</html>