Update index.html
Browse files- index.html +34 -17
index.html
CHANGED
@@ -1,19 +1,36 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<title>Goals of the World Health Organization</title>
|
5 |
+
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
|
6 |
+
<script src="https://cdn.jsdelivr.net/npm/@huggingface/[email protected]/dist/transformers.min.js"></script>
|
7 |
+
<script>
|
8 |
+
async function generateGoals() {
|
9 |
+
// Load the GPT-2 model
|
10 |
+
const model = await transformers.gpt2.GPT2Model.fromPretrained("gpt2");
|
11 |
+
|
12 |
+
// Set up the tokenizer
|
13 |
+
const tokenizer = await transformers.gpt2.GPT2Tokenizer.fromPretrained("gpt2");
|
14 |
+
|
15 |
+
// Define the input text
|
16 |
+
const input = "The goals of the World Health Organization are";
|
17 |
+
|
18 |
+
// Encode the input text
|
19 |
+
const encodedInput = tokenizer.encode(input);
|
20 |
+
|
21 |
+
// Generate the output text using the GPT-2 model
|
22 |
+
const output = await model.generate(tf.tensor2d(encodedInput, [1, encodedInput.length]), { maxOutputLength: 200 });
|
23 |
+
|
24 |
+
// Decode the output text
|
25 |
+
const decodedOutput = tokenizer.decode(output.arraySync()[0], { skipSpecialTokens: true });
|
26 |
+
|
27 |
+
// Display the output text in the HTML page
|
28 |
+
document.getElementById("goals").innerHTML = decodedOutput;
|
29 |
+
}
|
30 |
+
</script>
|
31 |
+
</head>
|
32 |
+
<body onload="generateGoals()">
|
33 |
+
<h1>Goals of the World Health Organization</h1>
|
34 |
+
<p id="goals">Loading...</p>
|
35 |
+
</body>
|
36 |
+
</html>
|