Spaces:
Running
Running
Paar, F. (Ferdinand) commited on
Commit ·
a86908c
1
Parent(s): 161e899
final commit3
Browse files- frontend/script.js +10 -10
frontend/script.js
CHANGED
|
@@ -16,7 +16,7 @@ document.getElementById('textForm').addEventListener('submit', async (e) => {
|
|
| 16 |
const data = await response.json();
|
| 17 |
|
| 18 |
// Use data.tokens and data.attention from your POST response
|
| 19 |
-
displayOutput(data);
|
| 20 |
displayHoverTokens(data, 0, 0);
|
| 21 |
// Changed call here to pass the entire data object
|
| 22 |
renderModelView(data);
|
|
@@ -121,15 +121,15 @@ function createAttentionThumbnail(data, layerIdx, headIdx) {
|
|
| 121 |
}
|
| 122 |
|
| 123 |
// Function to display the tokens and attention values
|
| 124 |
-
function displayOutput(data) {
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
}
|
| 133 |
|
| 134 |
function renderTokens(tokens, attentionData, layer_idx, head_idx) {
|
| 135 |
const container = document.getElementById('tokenContainer');
|
|
|
|
| 16 |
const data = await response.json();
|
| 17 |
|
| 18 |
// Use data.tokens and data.attention from your POST response
|
| 19 |
+
// displayOutput(data);
|
| 20 |
displayHoverTokens(data, 0, 0);
|
| 21 |
// Changed call here to pass the entire data object
|
| 22 |
renderModelView(data);
|
|
|
|
| 121 |
}
|
| 122 |
|
| 123 |
// Function to display the tokens and attention values
|
| 124 |
+
// function displayOutput(data) {
|
| 125 |
+
// const outputDiv = document.getElementById('output');
|
| 126 |
+
// outputDiv.innerHTML = `
|
| 127 |
+
// <h2>Tokens</h2>
|
| 128 |
+
// <pre>${JSON.stringify(data.tokens, null, 2)}</pre>
|
| 129 |
+
// <h2>Attention</h2>
|
| 130 |
+
// <pre>${JSON.stringify(data.attention, null, 2)}</pre>
|
| 131 |
+
// `;
|
| 132 |
+
// }
|
| 133 |
|
| 134 |
function renderTokens(tokens, attentionData, layer_idx, head_idx) {
|
| 135 |
const container = document.getElementById('tokenContainer');
|