Update sentiments.html
Browse files- sentiments.html +8 -2
sentiments.html
CHANGED
@@ -7,7 +7,8 @@
|
|
7 |
|
8 |
<script type="module">
|
9 |
// To-Do: transfomers.js ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค pipeline ํจ์๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํ import ๊ตฌ๋ฌธ์ ์์ฑํ์ญ์์ค.
|
10 |
-
// ํํธ:
|
|
|
11 |
|
12 |
// Make it available globally
|
13 |
window.pipeline = pipeline;
|
@@ -115,7 +116,9 @@
|
|
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() {
|
@@ -131,6 +134,9 @@
|
|
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);
|
|
|
7 |
|
8 |
<script type="module">
|
9 |
// To-Do: transfomers.js ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค pipeline ํจ์๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํ import ๊ตฌ๋ฌธ์ ์์ฑํ์ญ์์ค.
|
10 |
+
// ํํธ:
|
11 |
+
import {pipeline} from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
|
12 |
|
13 |
// Make it available globally
|
14 |
window.pipeline = pipeline;
|
|
|
116 |
async function initializeModel() {
|
117 |
// pipeline ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ฑ๋ถ์์ ์ฌ์ฉํ Xenova/distilbert-base-uncased-finetuned-sst-2-english ๋ชจ๋ธ ๊ฐ์ฒด๋ฅผ ์์ฑํ์ฌ sentimentAnalysis์ ์ ์ฅํ์ญ์์ค
|
118 |
// ํํธ: sentimentAnalysis = await pipeline
|
119 |
+
|
120 |
+
sentimentAnalysis = await pipeline('sentiment-analysis');
|
121 |
+
|
122 |
}
|
123 |
|
124 |
async function analyzeSentiment() {
|
|
|
134 |
const textFieldValue2 = document.getElementById("sentimentText2").value.trim();
|
135 |
// ์์์ ์์ฑํ ๊ฐ์ฑ๋ถ์ ๋ชจ๋ธ ๊ฐ์ฒด์ sentimentText1๊ณผ sentimentText2๋ฅผ ์
๋ ฅํ์ฌ ๊ฐ์๋ถ์์ ์ํํ๊ณ ๊ทธ ๊ฒฐ๊ณผ๋ฅผ result์ ์ ์ ํ์ญ์์ค.
|
136 |
// ํํธ : cont result =
|
137 |
+
|
138 |
+
cont result = await sentimentAnalysis (sentimentText1, sentimentText2);
|
139 |
+
|
140 |
|
141 |
|
142 |
document.getElementById("outputArea2").innerText = JSON.stringify(result, null, 2);
|