rcajegas commited on
Commit
00dc43d
·
1 Parent(s): 43a1a56

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +34 -17
index.html CHANGED
@@ -1,19 +1,36 @@
1
  <!DOCTYPE html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>