Spaces:
Running
Running
Update index.html
Browse files- index.html +107 -112
index.html
CHANGED
|
@@ -19,7 +19,6 @@
|
|
| 19 |
</html>
|
| 20 |
-->
|
| 21 |
|
| 22 |
-
<!DOCTYPE html>
|
| 23 |
<!DOCTYPE html>
|
| 24 |
<html lang="en">
|
| 25 |
<head>
|
|
@@ -35,7 +34,7 @@
|
|
| 35 |
|
| 36 |
body {
|
| 37 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
| 38 |
-
background: #
|
| 39 |
min-height: 100vh;
|
| 40 |
display: flex;
|
| 41 |
justify-content: center;
|
|
@@ -45,124 +44,161 @@
|
|
| 45 |
|
| 46 |
.card {
|
| 47 |
background: white;
|
| 48 |
-
border-radius:
|
| 49 |
-
padding: 40px;
|
| 50 |
-
max-width:
|
| 51 |
width: 100%;
|
| 52 |
-
box-shadow: 0
|
| 53 |
-
border: 1px solid #
|
| 54 |
}
|
| 55 |
|
| 56 |
h1 {
|
| 57 |
color: #1a1a1a;
|
| 58 |
-
|
| 59 |
-
font-size: 1.8rem;
|
| 60 |
font-weight: 600;
|
|
|
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
.subtitle {
|
| 64 |
color: #666;
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
padding-bottom:
|
| 68 |
border-bottom: 1px solid #eee;
|
|
|
|
| 69 |
}
|
| 70 |
|
| 71 |
.model-status {
|
| 72 |
-
margin:
|
| 73 |
-
padding:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
font-
|
| 77 |
-
color: #1a5a8c;
|
| 78 |
-
border: 1px solid #d0e3ff;
|
| 79 |
}
|
| 80 |
|
| 81 |
.model-status.loading {
|
| 82 |
-
|
| 83 |
-
border-color: #fcd34d;
|
| 84 |
-
color: #92400e;
|
| 85 |
}
|
| 86 |
|
| 87 |
-
.model-status.
|
| 88 |
-
|
| 89 |
-
border-color: #6ee7b7;
|
| 90 |
-
color: #065f46;
|
| 91 |
}
|
| 92 |
|
| 93 |
-
.
|
| 94 |
-
|
| 95 |
-
border-color: #fca5a5;
|
| 96 |
-
color: #991b1b;
|
| 97 |
}
|
| 98 |
|
| 99 |
-
label {
|
| 100 |
display: block;
|
| 101 |
-
font-weight:
|
| 102 |
color: #333;
|
| 103 |
-
margin-bottom:
|
| 104 |
-
font-size: 0.
|
| 105 |
}
|
| 106 |
|
| 107 |
textarea {
|
| 108 |
width: 100%;
|
| 109 |
-
padding:
|
| 110 |
border: 1px solid #d0d0d0;
|
| 111 |
-
border-radius:
|
| 112 |
-
font-size:
|
| 113 |
font-family: inherit;
|
| 114 |
resize: vertical;
|
| 115 |
transition: border-color 0.2s;
|
| 116 |
-
min-height:
|
| 117 |
-
background:
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
textarea:focus {
|
| 121 |
outline: none;
|
| 122 |
border-color: #4a6cf7;
|
| 123 |
-
background: white;
|
| 124 |
}
|
| 125 |
|
| 126 |
textarea::placeholder {
|
| 127 |
color: #999;
|
| 128 |
}
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
.button-group {
|
| 131 |
display: flex;
|
| 132 |
gap: 10px;
|
| 133 |
-
margin:
|
| 134 |
}
|
| 135 |
|
| 136 |
button {
|
| 137 |
-
padding:
|
| 138 |
-
border-radius:
|
| 139 |
-
font-size:
|
| 140 |
font-weight: 500;
|
| 141 |
cursor: pointer;
|
| 142 |
transition: all 0.2s;
|
| 143 |
border: 1px solid transparent;
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
.submit-btn {
|
| 147 |
background: #4a6cf7;
|
| 148 |
color: white;
|
| 149 |
-
|
|
|
|
|
|
|
| 150 |
}
|
| 151 |
|
| 152 |
.submit-btn:hover:not(:disabled) {
|
| 153 |
background: #3b5de7;
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
.submit-btn:disabled {
|
| 157 |
background: #a0aec0;
|
|
|
|
| 158 |
cursor: not-allowed;
|
| 159 |
}
|
| 160 |
|
| 161 |
.clear-btn {
|
| 162 |
-
background: white;
|
| 163 |
color: #4a5568;
|
| 164 |
border-color: #d0d0d0;
|
| 165 |
-
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
.clear-btn:hover:not(:disabled) {
|
|
@@ -175,42 +211,10 @@
|
|
| 175 |
cursor: not-allowed;
|
| 176 |
}
|
| 177 |
|
| 178 |
-
.output-section {
|
| 179 |
-
margin-top: 5px;
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
.output-section label {
|
| 183 |
-
margin-bottom: 6px;
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
#outputText {
|
| 187 |
-
background: #fafafa;
|
| 188 |
-
padding: 12px 14px;
|
| 189 |
-
border-radius: 6px;
|
| 190 |
-
min-height: 80px;
|
| 191 |
-
border: 1px solid #e0e0e0;
|
| 192 |
-
color: #333;
|
| 193 |
-
white-space: pre-wrap;
|
| 194 |
-
word-wrap: break-word;
|
| 195 |
-
font-size: 15px;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
#outputText .placeholder {
|
| 199 |
-
color: #999;
|
| 200 |
-
}
|
| 201 |
-
|
| 202 |
-
#outputText.loading {
|
| 203 |
-
color: #4a6cf7;
|
| 204 |
-
}
|
| 205 |
-
|
| 206 |
-
#outputText.error {
|
| 207 |
-
color: #e53e3e;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
.token-info {
|
| 211 |
-
margin-top:
|
| 212 |
-
font-size: 0.
|
| 213 |
-
color: #
|
| 214 |
text-align: right;
|
| 215 |
}
|
| 216 |
|
|
@@ -220,16 +224,21 @@
|
|
| 220 |
}
|
| 221 |
|
| 222 |
h1 {
|
| 223 |
-
font-size: 1.
|
| 224 |
}
|
| 225 |
|
| 226 |
.button-group {
|
| 227 |
-
flex-
|
| 228 |
}
|
| 229 |
|
| 230 |
-
.
|
| 231 |
flex: 1;
|
| 232 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
}
|
| 234 |
</style>
|
| 235 |
</head>
|
|
@@ -238,12 +247,10 @@
|
|
| 238 |
<h1>AI Text summarization</h1>
|
| 239 |
<div class="subtitle">Powered by FalconsAI T5 Sequence-to-Sequence model.</div>
|
| 240 |
|
| 241 |
-
<!-- Model status
|
| 242 |
-
<div id="modelStatus" class="model-status loading">
|
| 243 |
-
⏳ Loading model... Please wait
|
| 244 |
-
</div>
|
| 245 |
|
| 246 |
-
<div>
|
| 247 |
<label for="inputText">Input text to summarize:</label>
|
| 248 |
<textarea
|
| 249 |
id="inputText"
|
|
@@ -252,16 +259,16 @@
|
|
| 252 |
></textarea>
|
| 253 |
</div>
|
| 254 |
|
| 255 |
-
<div class="
|
| 256 |
-
<button id="summarizeButton" class="submit-btn" disabled>Submit</button>
|
| 257 |
-
<button id="clearButton" class="clear-btn" disabled>Clear</button>
|
| 258 |
-
</div>
|
| 259 |
-
|
| 260 |
-
<div class="output-section">
|
| 261 |
<label for="outputText">Summarized text:</label>
|
| 262 |
<div id="outputText"><span class="placeholder">Your summary will appear here...</span></div>
|
| 263 |
<div id="tokenInfo" class="token-info"></div>
|
| 264 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
</div>
|
| 266 |
|
| 267 |
<!-- Use the official @huggingface/transformers import map -->
|
|
@@ -290,7 +297,7 @@
|
|
| 290 |
|
| 291 |
async function initModel() {
|
| 292 |
try {
|
| 293 |
-
modelStatus.textContent = '⏳
|
| 294 |
modelStatus.className = 'model-status loading';
|
| 295 |
summarizeBtn.disabled = true;
|
| 296 |
clearBtn.disabled = true;
|
|
@@ -302,7 +309,7 @@
|
|
| 302 |
|
| 303 |
isModelReady = true;
|
| 304 |
modelStatus.textContent = '✅ Model loaded successfully! Ready to summarize.';
|
| 305 |
-
modelStatus.className = 'model-status
|
| 306 |
summarizeBtn.disabled = false;
|
| 307 |
clearBtn.disabled = false;
|
| 308 |
|
|
@@ -329,7 +336,6 @@
|
|
| 329 |
|
| 330 |
const text = inputText.value.trim();
|
| 331 |
|
| 332 |
-
// Check if input is empty
|
| 333 |
if (!text) {
|
| 334 |
outputText.textContent = 'Please enter document text to summarize.';
|
| 335 |
outputText.className = 'error';
|
|
@@ -337,10 +343,8 @@
|
|
| 337 |
return;
|
| 338 |
}
|
| 339 |
|
| 340 |
-
// Approximate token count using words
|
| 341 |
const inputTokens = text.split(/\s+/).length;
|
| 342 |
|
| 343 |
-
// Check if word count is less than 5
|
| 344 |
if (inputTokens < 5) {
|
| 345 |
outputText.textContent = 'Insufficient text to summarize.';
|
| 346 |
outputText.className = 'error';
|
|
@@ -348,18 +352,13 @@
|
|
| 348 |
return;
|
| 349 |
}
|
| 350 |
|
| 351 |
-
// Show loading state
|
| 352 |
outputText.textContent = 'Summarizing...';
|
| 353 |
outputText.className = 'loading';
|
| 354 |
summarizeBtn.disabled = true;
|
| 355 |
tokenInfo.textContent = '';
|
| 356 |
|
| 357 |
try {
|
| 358 |
-
|
| 359 |
-
const result = await summarizer(text, {
|
| 360 |
-
truncation: true
|
| 361 |
-
});
|
| 362 |
-
|
| 363 |
const summaryText = result[0].summary_text;
|
| 364 |
const outputTokens = summaryText.split(/\s+/).length;
|
| 365 |
|
|
@@ -378,19 +377,16 @@
|
|
| 378 |
}
|
| 379 |
}
|
| 380 |
|
| 381 |
-
// Clear function
|
| 382 |
function clearAll() {
|
| 383 |
inputText.value = '';
|
| 384 |
-
outputText.
|
| 385 |
outputText.className = '';
|
| 386 |
tokenInfo.textContent = '';
|
| 387 |
}
|
| 388 |
|
| 389 |
-
// Event listeners
|
| 390 |
summarizeBtn.addEventListener('click', summarize);
|
| 391 |
clearBtn.addEventListener('click', clearAll);
|
| 392 |
|
| 393 |
-
// Allow Ctrl+Enter to summarize
|
| 394 |
inputText.addEventListener('keydown', (e) => {
|
| 395 |
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
| 396 |
e.preventDefault();
|
|
@@ -398,7 +394,6 @@
|
|
| 398 |
}
|
| 399 |
});
|
| 400 |
|
| 401 |
-
// Initialize the model when the page loads
|
| 402 |
console.log('🚀 Loading FalconsAI summarization model...');
|
| 403 |
initModel();
|
| 404 |
</script>
|
|
|
|
| 19 |
</html>
|
| 20 |
-->
|
| 21 |
|
|
|
|
| 22 |
<!DOCTYPE html>
|
| 23 |
<html lang="en">
|
| 24 |
<head>
|
|
|
|
| 34 |
|
| 35 |
body {
|
| 36 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
| 37 |
+
background: #f5f5f5;
|
| 38 |
min-height: 100vh;
|
| 39 |
display: flex;
|
| 40 |
justify-content: center;
|
|
|
|
| 44 |
|
| 45 |
.card {
|
| 46 |
background: white;
|
| 47 |
+
border-radius: 8px;
|
| 48 |
+
padding: 32px 40px;
|
| 49 |
+
max-width: 680px;
|
| 50 |
width: 100%;
|
| 51 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
|
| 52 |
+
border: 1px solid #e8e8e8;
|
| 53 |
}
|
| 54 |
|
| 55 |
h1 {
|
| 56 |
color: #1a1a1a;
|
| 57 |
+
font-size: 1.6rem;
|
|
|
|
| 58 |
font-weight: 600;
|
| 59 |
+
margin-bottom: 4px;
|
| 60 |
+
letter-spacing: -0.3px;
|
| 61 |
}
|
| 62 |
|
| 63 |
.subtitle {
|
| 64 |
color: #666;
|
| 65 |
+
font-size: 0.9rem;
|
| 66 |
+
margin-bottom: 24px;
|
| 67 |
+
padding-bottom: 16px;
|
| 68 |
border-bottom: 1px solid #eee;
|
| 69 |
+
font-weight: 400;
|
| 70 |
}
|
| 71 |
|
| 72 |
.model-status {
|
| 73 |
+
margin: -8px 0 20px 0;
|
| 74 |
+
padding: 8px 0;
|
| 75 |
+
font-size: 0.85rem;
|
| 76 |
+
color: #2d7a3a;
|
| 77 |
+
font-weight: 400;
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
.model-status.loading {
|
| 81 |
+
color: #b45309;
|
|
|
|
|
|
|
| 82 |
}
|
| 83 |
|
| 84 |
+
.model-status.error {
|
| 85 |
+
color: #b91c1c;
|
|
|
|
|
|
|
| 86 |
}
|
| 87 |
|
| 88 |
+
.input-group {
|
| 89 |
+
margin-bottom: 16px;
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
+
.input-group label {
|
| 93 |
display: block;
|
| 94 |
+
font-weight: 500;
|
| 95 |
color: #333;
|
| 96 |
+
margin-bottom: 6px;
|
| 97 |
+
font-size: 0.9rem;
|
| 98 |
}
|
| 99 |
|
| 100 |
textarea {
|
| 101 |
width: 100%;
|
| 102 |
+
padding: 10px 12px;
|
| 103 |
border: 1px solid #d0d0d0;
|
| 104 |
+
border-radius: 4px;
|
| 105 |
+
font-size: 14px;
|
| 106 |
font-family: inherit;
|
| 107 |
resize: vertical;
|
| 108 |
transition: border-color 0.2s;
|
| 109 |
+
min-height: 120px;
|
| 110 |
+
background: white;
|
| 111 |
+
color: #333;
|
| 112 |
+
line-height: 1.5;
|
| 113 |
}
|
| 114 |
|
| 115 |
textarea:focus {
|
| 116 |
outline: none;
|
| 117 |
border-color: #4a6cf7;
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
textarea::placeholder {
|
| 121 |
color: #999;
|
| 122 |
}
|
| 123 |
|
| 124 |
+
.output-group {
|
| 125 |
+
margin-bottom: 16px;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.output-group label {
|
| 129 |
+
display: block;
|
| 130 |
+
font-weight: 500;
|
| 131 |
+
color: #333;
|
| 132 |
+
margin-bottom: 6px;
|
| 133 |
+
font-size: 0.9rem;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
#outputText {
|
| 137 |
+
background: #fafafa;
|
| 138 |
+
padding: 10px 12px;
|
| 139 |
+
border-radius: 4px;
|
| 140 |
+
min-height: 80px;
|
| 141 |
+
border: 1px solid #e8e8e8;
|
| 142 |
+
color: #333;
|
| 143 |
+
white-space: pre-wrap;
|
| 144 |
+
word-wrap: break-word;
|
| 145 |
+
font-size: 14px;
|
| 146 |
+
line-height: 1.5;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
#outputText .placeholder {
|
| 150 |
+
color: #999;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
#outputText.error {
|
| 154 |
+
color: #b91c1c;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
#outputText.loading {
|
| 158 |
+
color: #4a6cf7;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
.button-group {
|
| 162 |
display: flex;
|
| 163 |
gap: 10px;
|
| 164 |
+
margin-top: 4px;
|
| 165 |
}
|
| 166 |
|
| 167 |
button {
|
| 168 |
+
padding: 8px 24px;
|
| 169 |
+
border-radius: 4px;
|
| 170 |
+
font-size: 14px;
|
| 171 |
font-weight: 500;
|
| 172 |
cursor: pointer;
|
| 173 |
transition: all 0.2s;
|
| 174 |
border: 1px solid transparent;
|
| 175 |
+
background: transparent;
|
| 176 |
}
|
| 177 |
|
| 178 |
.submit-btn {
|
| 179 |
background: #4a6cf7;
|
| 180 |
color: white;
|
| 181 |
+
border-color: #4a6cf7;
|
| 182 |
+
order: 2;
|
| 183 |
+
margin-left: auto;
|
| 184 |
}
|
| 185 |
|
| 186 |
.submit-btn:hover:not(:disabled) {
|
| 187 |
background: #3b5de7;
|
| 188 |
+
border-color: #3b5de7;
|
| 189 |
}
|
| 190 |
|
| 191 |
.submit-btn:disabled {
|
| 192 |
background: #a0aec0;
|
| 193 |
+
border-color: #a0aec0;
|
| 194 |
cursor: not-allowed;
|
| 195 |
}
|
| 196 |
|
| 197 |
.clear-btn {
|
|
|
|
| 198 |
color: #4a5568;
|
| 199 |
border-color: #d0d0d0;
|
| 200 |
+
background: white;
|
| 201 |
+
order: 1;
|
| 202 |
}
|
| 203 |
|
| 204 |
.clear-btn:hover:not(:disabled) {
|
|
|
|
| 211 |
cursor: not-allowed;
|
| 212 |
}
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
.token-info {
|
| 215 |
+
margin-top: 8px;
|
| 216 |
+
font-size: 0.8rem;
|
| 217 |
+
color: #999;
|
| 218 |
text-align: right;
|
| 219 |
}
|
| 220 |
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
h1 {
|
| 227 |
+
font-size: 1.3rem;
|
| 228 |
}
|
| 229 |
|
| 230 |
.button-group {
|
| 231 |
+
flex-wrap: wrap;
|
| 232 |
}
|
| 233 |
|
| 234 |
+
.submit-btn {
|
| 235 |
flex: 1;
|
| 236 |
}
|
| 237 |
+
|
| 238 |
+
.clear-btn {
|
| 239 |
+
flex: 0.4;
|
| 240 |
+
min-width: 80px;
|
| 241 |
+
}
|
| 242 |
}
|
| 243 |
</style>
|
| 244 |
</head>
|
|
|
|
| 247 |
<h1>AI Text summarization</h1>
|
| 248 |
<div class="subtitle">Powered by FalconsAI T5 Sequence-to-Sequence model.</div>
|
| 249 |
|
| 250 |
+
<!-- Model status - styled to blend in, not stand out -->
|
| 251 |
+
<div id="modelStatus" class="model-status loading">⏳ Loading model...</div>
|
|
|
|
|
|
|
| 252 |
|
| 253 |
+
<div class="input-group">
|
| 254 |
<label for="inputText">Input text to summarize:</label>
|
| 255 |
<textarea
|
| 256 |
id="inputText"
|
|
|
|
| 259 |
></textarea>
|
| 260 |
</div>
|
| 261 |
|
| 262 |
+
<div class="output-group">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
<label for="outputText">Summarized text:</label>
|
| 264 |
<div id="outputText"><span class="placeholder">Your summary will appear here...</span></div>
|
| 265 |
<div id="tokenInfo" class="token-info"></div>
|
| 266 |
</div>
|
| 267 |
+
|
| 268 |
+
<div class="button-group">
|
| 269 |
+
<button id="clearButton" class="clear-btn" disabled>Clear</button>
|
| 270 |
+
<button id="summarizeButton" class="submit-btn" disabled>Submit</button>
|
| 271 |
+
</div>
|
| 272 |
</div>
|
| 273 |
|
| 274 |
<!-- Use the official @huggingface/transformers import map -->
|
|
|
|
| 297 |
|
| 298 |
async function initModel() {
|
| 299 |
try {
|
| 300 |
+
modelStatus.textContent = '⏳ Loading model...';
|
| 301 |
modelStatus.className = 'model-status loading';
|
| 302 |
summarizeBtn.disabled = true;
|
| 303 |
clearBtn.disabled = true;
|
|
|
|
| 309 |
|
| 310 |
isModelReady = true;
|
| 311 |
modelStatus.textContent = '✅ Model loaded successfully! Ready to summarize.';
|
| 312 |
+
modelStatus.className = 'model-status';
|
| 313 |
summarizeBtn.disabled = false;
|
| 314 |
clearBtn.disabled = false;
|
| 315 |
|
|
|
|
| 336 |
|
| 337 |
const text = inputText.value.trim();
|
| 338 |
|
|
|
|
| 339 |
if (!text) {
|
| 340 |
outputText.textContent = 'Please enter document text to summarize.';
|
| 341 |
outputText.className = 'error';
|
|
|
|
| 343 |
return;
|
| 344 |
}
|
| 345 |
|
|
|
|
| 346 |
const inputTokens = text.split(/\s+/).length;
|
| 347 |
|
|
|
|
| 348 |
if (inputTokens < 5) {
|
| 349 |
outputText.textContent = 'Insufficient text to summarize.';
|
| 350 |
outputText.className = 'error';
|
|
|
|
| 352 |
return;
|
| 353 |
}
|
| 354 |
|
|
|
|
| 355 |
outputText.textContent = 'Summarizing...';
|
| 356 |
outputText.className = 'loading';
|
| 357 |
summarizeBtn.disabled = true;
|
| 358 |
tokenInfo.textContent = '';
|
| 359 |
|
| 360 |
try {
|
| 361 |
+
const result = await summarizer(text, { truncation: true });
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
const summaryText = result[0].summary_text;
|
| 363 |
const outputTokens = summaryText.split(/\s+/).length;
|
| 364 |
|
|
|
|
| 377 |
}
|
| 378 |
}
|
| 379 |
|
|
|
|
| 380 |
function clearAll() {
|
| 381 |
inputText.value = '';
|
| 382 |
+
outputText.innerHTML = '<span class="placeholder">Your summary will appear here...</span>';
|
| 383 |
outputText.className = '';
|
| 384 |
tokenInfo.textContent = '';
|
| 385 |
}
|
| 386 |
|
|
|
|
| 387 |
summarizeBtn.addEventListener('click', summarize);
|
| 388 |
clearBtn.addEventListener('click', clearAll);
|
| 389 |
|
|
|
|
| 390 |
inputText.addEventListener('keydown', (e) => {
|
| 391 |
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
| 392 |
e.preventDefault();
|
|
|
|
| 394 |
}
|
| 395 |
});
|
| 396 |
|
|
|
|
| 397 |
console.log('🚀 Loading FalconsAI summarization model...');
|
| 398 |
initModel();
|
| 399 |
</script>
|