Spaces:
Running
Running
Update sentiments.html
Browse files- 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 |
-
//
|
10 |
-
import {
|
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 |
-
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
async function analyzeSentiment() {
|
@@ -126,10 +127,11 @@
|
|
126 |
}
|
127 |
|
128 |
async function analyzeSentimentMulti() {
|
129 |
-
const textFieldValue1 = document.getElementById("
|
130 |
const textFieldValue2 = document.getElementById("sentimentText2").value.trim();
|
131 |
-
|
132 |
-
|
|
|
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 |
}
|