-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
261 lines (238 loc) · 12.2 KB
/
index.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html>
<html lang="en">
<head>
<!-- a comment to fix cache issue -->
<meta charset="UTF-8">
<meta http-equiv="origin-trial" content="Ah4InzKNUH3VbS0d82fSwGjoTIPYKHZNDzn10rIJIekQZIFiUXXRZ3zmhpdBU2FkmET+W/u42fqwdFYJCo3VLA0AAABleyJvcmlnaW4iOiJodHRwczovL3NvbmExMTExLmdpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViR1BVIiwiZXhwaXJ5IjoxNjUyODMxOTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZX0=">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="main.css">
<title>WebGPU Super Resolution Inference</title>
<script>
let current_network = null;
let current_device = null;
let device_model_pointers = null;
let device_model_meta = null;
let shader_modules = null;
</script>
<script src="localStorageDB.min.js"></script>
<script src="weightsreader.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand rainbow-text" href="#">Awesome</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Super Resolution</a></li>
<li><a href="https://github.com/sona1111/webgpu-super-resolution">About</a></li>
<!-- <li><a href="#contact">Contact</a></li>-->
<!-- <li class="dropdown">-->
<!-- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>-->
<!-- <ul class="dropdown-menu">-->
<!-- <li><a href="#">Action</a></li>-->
<!-- <li><a href="#">Another action</a></li>-->
<!-- <li><a href="#">Something else here</a></li>-->
<!-- <li role="separator" class="divider"></li>-->
<!-- <li class="dropdown-header">Nav header</li>-->
<!-- <li><a href="#">Separated link</a></li>-->
<!-- <li><a href="#">One more separated link</a></li>-->
<!-- </ul>-->
<!-- </li>-->
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<div class="jumbotron">
<div class="col-sm-3">
<img src="static/img/webgpu_128.png">
</div>
<div class="col-sm-9">
<h3>Client side WebGPU Super Resolution with <a href="https://github.com/xinntao/ESRGAN">ESRGAN</a>!!</h3>
<ol>
<li>Choose a model to load (See <a href="https://github.com/xinntao/Real-ESRGAN/blob/master/docs/model_zoo.md">this page</a> for more details on the models)</li>
<li>Select a demo image or upload your own</li>
<li>Be amazed!</li>
</ol>
</div>
<div class="col-sm-12" style="margin-bottom: -40px;">
<div id="clientinfopanel" class="panel">
<div class="panel-heading">
<h3 class="panel-title">Client GPU Info</h3>
</div>
<div class="panel-body">
<pre id="clientinfodata">
</pre>
</div>
</div>
</div>
<br style="clear: both">
</div>
<hr style="clear: both">
<div class="col-md-12" id="networksList">
<div class="col-sm-2">
<div class="panel panel-default networkpanel">
<div class="panel-body text-center">
<h6>RRDB ESRGAN</h6>
<img style="width: 100%;" src="static/img/nn_esrgan.png">
<button class="btn btn-primary btn-sm networkload" data-networkname="RRDB_ESRGAN_x4" disabled>LOAD</button>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-default networkpanel">
<div class="panel-body text-center">
<h6>RRDB PSNR</h6>
<img style="width: 100%;" src="static/img/nn_psnr.png">
<button class="btn btn-primary btn-sm networkload" data-networkname="RRDB_PSNR_x4" disabled>LOAD</button>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-default networkpanel">
<div class="panel-body text-center">
<h6>Real GAN x4plus Anime</h6>
<img style="width: 100%;" src="static/img/nn_anime.png">
<button class="btn btn-primary btn-sm networkload" data-networkname="RealESRGAN_x4plus_anime_6B" disabled>LOAD</button>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-default networkpanel">
<div class="panel-body text-center">
<h6>Real GAN x4plus</h6>
<img style="width: 100%;" src="static/img/nn_real_plus.png">
<button class="btn btn-primary btn-sm networkload" data-networkname="RealESRGAN_x4plus" disabled>LOAD</button>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-default networkpanel">
<div class="panel-body text-center">
<h6>Real NET x4plus</h6>
<img style="width: 100%;" src="static/img/nn_real_mse.png">
<button class="btn btn-primary btn-sm networkload" data-networkname="RealESRNet_x4plus" disabled>LOAD</button>
</div>
</div>
</div>
</div>
<hr style="clear: both">
<div class="col-md-12">
<div class="col-md-12">
<pre id="dataload_status">Init...</pre>
</div>
<div class="col-md-12">
<progress id="download_progress" value=""></progress>
</div>
<div class="col-sm-3">
<span>Mem usage:</span><span id="memusage">N/A</span>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="numDenseBlocks">Number of Layers (decrease for faster run time)</label>
<input type="number" class="form-control" id="numDenseBlocks" min="1" max="23" step="1" value="23">
</div>
</div>
</div>
<br style="clear: both">
<div class="col-md-12">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Demo ESRGAN</h3>
</div>
<div class="panel-body">
<img src="demo_img/baboon_sm.png" id="sm_img" class="btn btn-default" crossorigin="anonymous" style="display: none;">
<button type="button" id="demo1" disabled>Test Small Image</button>
<img src="demo_img/baboon.png" id="med_img" class="btn btn-default" crossorigin="anonymous" style="display: none;">
<button type="button" id="demo2" disabled>Test Medium Image</button>
<img src="demo_img/448x299.jpg" id="lrg_img" class="btn btn-default" crossorigin="anonymous" style="display: none;">
<button type="button" id="demo3" disabled>Test Large Image</button>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Upload your own image (currently support up to 400px by 400px)</h3>
</div>
<div class="panel-body">
<input id="imageUpload" name="imageUpload" type="file" disabled>
<button type="button" class="btn btn-default" id="mannualrerun" disabled>Re-Run</button>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Result</h3>
</div>
<div class="panel-body" id="resultpanel">
<canvas id="original"></canvas>
<!-- <div id="networkrunningloader" class="lds-dual-ring"></div>-->
<p id="resultInfo" style="display: none;">
<span style="float: left;"><span>Upscaled ⌄</span><button type="button" id="downloadResultBtn" class="btn btn-success">⟱ Download Result ⟱</button></span><span id="dlborder"></span></p>
<canvas id="result"></canvas>
</div>
</div>
</div>
<!-- <div class="col-md-9">-->
<!-- <div class="panel panel-primary">-->
<!-- <div class="panel-heading">-->
<!-- <h3 class="panel-title">Result</h3>-->
<!-- </div>-->
<!-- <div class="panel-body">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
<script src="utils.js"></script>
<script src="rrbdnetC_v7.js"></script>
<script src="main.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
async function main(){
if(await populateWebGpuInfo()){
document.getElementById('clientinfopanel').classList.add('panel-success');
$('#networksList .networkload').prop('disabled', false);
initmain();
}else{
document.getElementById('clientinfopanel').classList.add('panel-danger');
}
$('#networksList .networkload').click(async function(){
$('.networkpanel').css('background-color', '');
//$('.networkpanel').removeclass('panel-default');
//$('.networkpanel').removeclass('panel-success');
const networkname = $(this).data('networkname');
await storeModelData(networkname, `ESRGAN_py/${networkname}`);
current_network = networkname;
if(current_network === 'RealESRGAN_x4plus_anime_6B'){
document.getElementById('numDenseBlocks').value = 6;
document.getElementById('numDenseBlocks').max = 6;
}else{
document.getElementById('numDenseBlocks').value = 23;
document.getElementById('numDenseBlocks').max = 23;
}
$(this).closest('.networkpanel').css('background-color', '#dff0d8');
$('#imageUpload, #demo1, #demo2, #demo3, #mannualrerun').prop('disabled', false);
})
}
main();
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>