seonoh12 commited on
Commit
b03c5c1
โ€ข
1 Parent(s): 9fdce57

Update text-to-text-generation.html

Browse files
Files changed (1) hide show
  1. text-to-text-generation.html +12 -15
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,36 +83,34 @@
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
  });
112
- // To-Do: result์˜ ๊ฐ’์„ stringd์œผ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ outputArea2์— ์ถœ๋ ฅํ•˜์‹ญ์‹œ์˜ค.
113
- // ํžŒํŠธ: document.getElementById("outputArea2") ์‚ฌ์šฉ
114
-
115
  }
116
-
117
  // Initialize the model after the DOM is completely loaded
118
  window.addEventListener("DOMContentLoaded", initializeModel);
119
  </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 currentDate = new Date().toDateString();
94
+ const currentTime = new Date().toLocaleTimeString();
95
  const result = await generator(textFieldValue, {
96
  max_new_tokens: 100,
97
  });
98
+ document.getElementById("outputArea").innerText = `Current Date: ${currentDate}\nCurrent Time: ${currentTime}\n\n${JSON.stringify(result, null, 2)}`;
 
99
  }
 
100
  async function generateText2() {
101
  const textFieldValue = document.getElementById("text-to-textGenerationText2").value.trim();
102
+ const currentDate = new Date().toDateString();
103
+ const currentTime = new Date().toLocaleTimeString();
104
  const result = await generator(textFieldValue, {
105
+ max_new_tokens: 200,
106
+ temperature: 0.9,
107
+ repetition_penalty: 2.0,
108
+ no_repeat_ngram_size: 3,
109
+ // top_k: 20,
110
+ // do_sample: true,
111
  });
112
+ document.getElementById("outputArea2").innerText = `Current Date: ${currentDate}\nCurrent Time: ${currentTime}\n\n${JSON.stringify(result, null, 2)}`;
 
 
113
  }
 
114
  // Initialize the model after the DOM is completely loaded
115
  window.addEventListener("DOMContentLoaded", initializeModel);
116
  </script>