forked from tensorflow/tfjs-models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
135 lines (117 loc) · 3.79 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
<!-- Copyright 2019 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================-->
<!DOCTYPE html>
<html>
<head>
<title>TensorFlow.js Universal Sentence Encoder lite demo</title>
<style>
h1 {
margin-bottom: 35px;
}
#main {
padding-top: 30px;
font-family: Helvetica, sans-serif;
max-width: 960px;
min-width: 600px;
width: 60vw;
margin-left: auto;
margin-right: auto;
}
#sentences-container {
flex: 1 1 auto;
}
#sentences-container>div {
margin-bottom: 10px;
}
#container {
display: flex;
flex-direction: row;
}
#self-similarity-matrix {
position: relative;
}
.labels {
position: absolute;
}
.x-axis {
bottom: 100%;
width: 100%;
height: 20px;
}
.x-axis>div {
transform: translateX(-50%);
}
.y-axis {
right: 100%;
height: 100%;
width: 20px;
}
.y-axis>div {
transform: translateY(-50%);
}
.labels>div {
position: absolute;
}
#description {
margin-bottom: 50px;
line-height: 1.6;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id='main'>
<h1>Universal Sentence Encoder lite demo</h1>
<div id="description">This demo is taken from the <a target="_blank"
href="https://colab.sandbox.google.com/github/tensorflow/hub/blob/master/examples/colab/semantic_similarity_with_tf_hub_universal_encoder_lite.ipynb#scrollTo=_GSCW5QIBKVe">TensorFlow
Hub Universal Sentence Encoder lite colab</a>. It shows the model's ability to group sentences by semantic
similarity usings their embeddings. The matrix on the right shows self-similarity scores (dot products) between
the embeddings for the sentences on the left. The redder the cell, the higher the similarity score.</div>
<div id="loading">
Loading the model...
</div>
<div id="container">
<div id="sentences-container"></div>
<div id="self-similarity-matrix">
<div class="labels y-axis"></div>
<div class="labels x-axis"></div>
<canvas></canvas>
</div>
</div>
</div>
<div id='main'>
<h1>Universal Sentence Encoder QnA demo</h1>
<div id="loadingQnA">
Loading the model...
</div>
<div id="description">
<h2>Encode Question and Answers</h2>
<h3>Question</h3>
<div>How are you feeling today?</div><br />
<h3>Answer 1</h3>
<div>I'm not feeling very well.</div>
<div>Score: <span id="answer_1"></span></div><br />
<h3>Answer 2</h3>
<div>Beijing is the capital of China.</div>
<div>Score: <span id="answer_2"></span></div><br />
<h3>Answer 3</h3>
<div>You have five fingers on your hand.</div>
<div>Score: <span id="answer_3"></span></div><br />
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu"></script>
<script src="index.js"></script>
</body>
</html>