oceankim commited on
Commit
2292d76
·
verified ·
1 Parent(s): 73db28a

Update text-to-text-generation.html

Browse files
Files changed (1) hide show
  1. text-to-text-generation.html +2 -13
text-to-text-generation.html CHANGED
@@ -8,7 +8,6 @@
8
  <script type="module">
9
  // Import the library
10
  import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
11
-
12
  // Make it available globally
13
  window.pipeline = pipeline;
14
  </script>
@@ -84,40 +83,30 @@
84
  </div>
85
 
86
  <script>
87
-
88
  let generator;
89
-
90
  // Initialize the sentiment analysis model
91
  async function initializeModel() {
92
  generator = await pipeline('text2text-generation', 'Xenova/LaMini-Flan-T5-783M');
93
-
94
  }
95
-
96
  async function generateText() {
97
  const textFieldValue = document.getElementById("text-to-textGenerationText").value.trim();
98
-
99
  const result = await generator(textFieldValue, {
100
  max_new_tokens: 100,
101
  });
102
-
103
  document.getElementById("outputArea").innerText = JSON.stringify(result, null, 2);
104
  }
105
-
106
  async function generateText2() {
107
  const textFieldValue = document.getElementById("text-to-textGenerationText2").value.trim();
108
-
109
  const result = await generator(textFieldValue, {
110
- // To-Do: generator 객체에 temperature 파라미터 값을 지정하십시오.
111
  max_new_tokens: 200,
112
  temperature: 0.9,
113
  repetition_penalty: 2.0,
114
  no_repeat_ngram_size: 3,
 
 
115
  });
116
- // To-Do: result의 값을 stringd으로 변환하여 outputArea2에 출력하십시오.
117
- // 힌트: document.getElementById("outputArea2") 사용
118
  document.getElementById("outputArea2").innerText = JSON.stringify(result, null, 2);
119
  }
120
-
121
  // Initialize the model after the DOM is completely loaded
122
  window.addEventListener("DOMContentLoaded", initializeModel);
123
  </script>
 
8
  <script type="module">
9
  // Import the library
10
  import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
 
11
  // Make it available globally
12
  window.pipeline = pipeline;
13
  </script>
 
83
  </div>
84
 
85
  <script>
 
86
  let generator;
 
87
  // Initialize the sentiment analysis model
88
  async function initializeModel() {
89
  generator = await pipeline('text2text-generation', 'Xenova/LaMini-Flan-T5-783M');
 
90
  }
 
91
  async function generateText() {
92
  const textFieldValue = document.getElementById("text-to-textGenerationText").value.trim();
 
93
  const result = await generator(textFieldValue, {
94
  max_new_tokens: 100,
95
  });
 
96
  document.getElementById("outputArea").innerText = JSON.stringify(result, null, 2);
97
  }
 
98
  async function generateText2() {
99
  const textFieldValue = document.getElementById("text-to-textGenerationText2").value.trim();
 
100
  const result = await generator(textFieldValue, {
 
101
  max_new_tokens: 200,
102
  temperature: 0.9,
103
  repetition_penalty: 2.0,
104
  no_repeat_ngram_size: 3,
105
+ // top_k: 20,
106
+ // do_sample: true,
107
  });
 
 
108
  document.getElementById("outputArea2").innerText = JSON.stringify(result, null, 2);
109
  }
 
110
  // Initialize the model after the DOM is completely loaded
111
  window.addEventListener("DOMContentLoaded", initializeModel);
112
  </script>