boazchung commited on
Commit
adfb63a
โ€ข
1 Parent(s): 4743ba2

Update sentiments.html

Browse files
Files changed (1) hide show
  1. sentiments.html +9 -7
sentiments.html CHANGED
@@ -6,8 +6,8 @@
6
  <title>Sentiment Analysis - Hugging Face Transformers.js</title>
7
 
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;
@@ -113,8 +113,9 @@
113
 
114
  // Initialize the sentiment analysis model
115
  async function initializeModel() {
116
- sentimentAnalysis = await pipeline('sentiment-analysis', 'Xenova/distilbert-base-uncased-finetuned-sst-2-english');
117
- toxic_classifier = await pipeline('text-classification', 'Xenova/toxic-bert');
 
118
  }
119
 
120
  async function analyzeSentiment() {
@@ -126,10 +127,11 @@
126
  }
127
 
128
  async function analyzeSentimentMulti() {
129
- const textFieldValue1 = document.getElementById("sentimentText1").value.trim();
130
  const textFieldValue2 = document.getElementById("sentimentText2").value.trim();
131
-
132
- const result = await sentimentAnalysis([textFieldValue1, textFieldValue2]);
 
133
 
134
  document.getElementById("outputArea2").innerText = JSON.stringify(result, null, 2);
135
  }
 
6
  <title>Sentiment Analysis - Hugging Face Transformers.js</title>
7
 
8
  <script type="module">
9
+ // To-Do: transfomers.js ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ค‘ pipeline ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ import ๊ตฌ๋ฌธ์„ ์™„์„ฑํ•˜์‹ญ์‹œ์˜ค.
10
+ // ํžŒํŠธ: import {}
11
 
12
  // Make it available globally
13
  window.pipeline = pipeline;
 
113
 
114
  // Initialize the sentiment analysis model
115
  async function initializeModel() {
116
+ // pipeline ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ์„ฑ๋ถ„์„์— ์‚ฌ์šฉํ•  Xenova/distilbert-base-uncased-finetuned-sst-2-english ๋ชจ๋ธ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜์—ฌ sentimentAnalysis์— ์ €์žฅํ•˜์‹ญ์‹œ์˜ค
117
+ // ํžŒํŠธ: sentimentAnalysis = await pipeline
118
+
119
  }
120
 
121
  async function analyzeSentiment() {
 
127
  }
128
 
129
  async function analyzeSentimentMulti() {
130
+ const textFieldValue1 = document.getElementById("sentimentText1sentimentText").value.trim();
131
  const textFieldValue2 = document.getElementById("sentimentText2").value.trim();
132
+ // ์œ„์—์„œ ์ƒ์„ฑํ•œ ๊ฐ์„ฑ๋ถ„์„ ๋ชจ๋ธ ๊ฐ์ฒด์— sentimentText1๊ณผ sentimentText2๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ๊ฐ์ƒ๋ถ„์„์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋ฅผ result์— ์ €์ •ํ•˜์‹ญ์‹œ์˜ค.
133
+ // ํžŒํŠธ : cont result =
134
+
135
 
136
  document.getElementById("outputArea2").innerText = JSON.stringify(result, null, 2);
137
  }