krishna195 commited on
Commit
7d57aa1
Β·
verified Β·
1 Parent(s): b732fba

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +6 -7
index.html CHANGED
@@ -3,17 +3,16 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Simple Text Generation</title>
7
  <script type="module">
8
  import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
9
-
10
  let generator;
11
 
12
- // Load the model once
13
  async function loadModel() {
14
  document.getElementById("status").innerText = "⏳ Loading model...";
15
  try {
16
- generator = await pipeline("text-generation", "Xenova/distilgpt2");
17
  document.getElementById("status").innerText = "βœ… Model loaded!";
18
  document.getElementById("generateBtn").disabled = false;
19
  } catch (error) {
@@ -30,7 +29,7 @@
30
  }
31
  document.getElementById("output").innerText = "⏳ Generating...";
32
  try {
33
- const output = await generator(inputText, { max_new_tokens: 50, do_sample: true });
34
  document.getElementById("output").innerText = output[0].generated_text;
35
  } catch (error) {
36
  document.getElementById("output").innerText = "❌ Error generating text.";
@@ -43,12 +42,12 @@
43
  </script>
44
  </head>
45
  <body>
46
- <h2>Simple Text Generation</h2>
47
  <p id="status">⏳ Loading model...</p>
48
  <textarea id="inputText" rows="3" cols="50" placeholder="Enter text..."></textarea>
49
  <br><br>
50
  <button id="generateBtn" onclick="generateText()" disabled>Generate</button>
51
  <h3>Output:</h3>
52
- <p id="output"></p>
53
  </body>
54
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Text Generation - LaMini-Flan-T5</title>
7
  <script type="module">
8
  import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
9
+
10
  let generator;
11
 
 
12
  async function loadModel() {
13
  document.getElementById("status").innerText = "⏳ Loading model...";
14
  try {
15
+ generator = await pipeline('text2text-generation', 'Xenova/LaMini-Flan-T5-783M');
16
  document.getElementById("status").innerText = "βœ… Model loaded!";
17
  document.getElementById("generateBtn").disabled = false;
18
  } catch (error) {
 
29
  }
30
  document.getElementById("output").innerText = "⏳ Generating...";
31
  try {
32
+ const output = await generator(inputText, { max_new_tokens: 100 });
33
  document.getElementById("output").innerText = output[0].generated_text;
34
  } catch (error) {
35
  document.getElementById("output").innerText = "❌ Error generating text.";
 
42
  </script>
43
  </head>
44
  <body>
45
+ <h2>Text Generation using LaMini-Flan-T5</h2>
46
  <p id="status">⏳ Loading model...</p>
47
  <textarea id="inputText" rows="3" cols="50" placeholder="Enter text..."></textarea>
48
  <br><br>
49
  <button id="generateBtn" onclick="generateText()" disabled>Generate</button>
50
  <h3>Output:</h3>
51
+ <pre id="output"></pre>
52
  </body>
53
  </html>