diff --git a/apps/embeddings/index.html b/apps/embeddings/3D/index.html similarity index 100% rename from apps/embeddings/index.html rename to apps/embeddings/3D/index.html diff --git a/apps/embeddings/v1.html b/apps/embeddings/3D/v1.html similarity index 100% rename from apps/embeddings/v1.html rename to apps/embeddings/3D/v1.html diff --git a/apps/embeddings/v2.html b/apps/embeddings/3D/v2.html similarity index 100% rename from apps/embeddings/v2.html rename to apps/embeddings/3D/v2.html diff --git a/apps/embeddings/v3.html b/apps/embeddings/3D/v3.html similarity index 100% rename from apps/embeddings/v3.html rename to apps/embeddings/3D/v3.html diff --git a/apps/star-visualization/index.html b/apps/embeddings/star/index.html similarity index 77% rename from apps/star-visualization/index.html rename to apps/embeddings/star/index.html index c817db3..f7972f9 100644 --- a/apps/star-visualization/index.html +++ b/apps/embeddings/star/index.html @@ -49,6 +49,42 @@ border: 1px solid #ddd; width: 300px; /* Adjust as needed */ } +.modal { + display: none; + position: fixed; + z-index: 1; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.4); + padding-top: 60px; +} + +.modal-content { + background-color: #fefefe; + margin: 5% auto; + padding: 20px; + border: 1px solid #888; + width: 80%; +} + +.close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + @@ -58,15 +94,22 @@ -
+
-
+
+ + @@ -294,15 +337,59 @@ performEmbeddingArithmetic(inputExpression); }); +document.addEventListener('DOMContentLoaded', () => { + const urlParams = new URLSearchParams(window.location.search); + + const loadEmbeddingsInterface = document.getElementById('loadEmbeddingsInterface'); + const visualizeTextInterface = document.getElementById('visualizeTextInterface'); + + // Default to showing both interfaces + loadEmbeddingsInterface.style.display = 'block'; + visualizeTextInterface.style.display = 'block'; + + // Check URL parameters and adjust display + if (urlParams.has('show')) { + const showParam = urlParams.get('show'); + if (showParam === 'load') { + visualizeTextInterface.style.display = 'none'; + } else if (showParam === 'visualize') { + loadEmbeddingsInterface.style.display = 'none'; + } + } +}); + document.getElementById('howToUseButton').addEventListener('click', function() { - alert("How to Use:\n\n" + - "- To visualize a word or phrase, simply enter it and click 'Visualize Embedding'.\n" + - "- You can perform arithmetic on phrases or words. For example, 'king' - 'man' + 'woman' results in the embedding for 'queen'.\n" + - "- Use quotes for multi-word phrases, e.g., \"computer programmer\" - \"hacker\".\n" + - "- The visualizations will appear on the canvas below.\n\n" + - "Note: Ensure the model is loaded (the 'Visualize Embedding' button will be enabled) before attempting to visualize."); + const modal = document.getElementById('howToUseModal'); + const modalText = document.getElementById('howToUseText'); + let instructions = "How to Use:\n\n"; + + // Check which interfaces are available and customize the instructions + if (document.getElementById('loadEmbeddingsInterface').style.display !== 'none') { + instructions += "- Load embeddings to visualize pre-saved phrases.\n"; + } + if (document.getElementById('visualizeTextInterface').style.display !== 'none') { + instructions += "- Enter a word or phrase and click 'Visualize Embedding' to see its representation.\n"; + instructions += "- Perform arithmetic on phrases or words, e.g., 'king' - 'man' + 'woman'.\n"; + instructions += "- Use quotes for multi-word phrases, e.g., \"computer programmer\" - \"hacker\".\n"; + } + + modalText.innerText = instructions; + modal.style.display = "block"; }); +// Close the modal when the user clicks on (x) +document.getElementsByClassName("close")[0].onclick = function() { + document.getElementById('howToUseModal').style.display = "none"; +} + +// Close the modal when the user clicks anywhere outside of the modal +window.onclick = function(event) { + const modal = document.getElementById('howToUseModal'); + if (event.target === modal) { + modal.style.display = "none"; + } +} + \ No newline at end of file diff --git a/apps/star-visualization/v1.html b/apps/embeddings/star/v1.html similarity index 100% rename from apps/star-visualization/v1.html rename to apps/embeddings/star/v1.html diff --git a/apps/star-visualization/v2.html b/apps/embeddings/star/v2.html similarity index 100% rename from apps/star-visualization/v2.html rename to apps/embeddings/star/v2.html diff --git a/apps/star-visualization/v3.html b/apps/embeddings/star/v3.html similarity index 100% rename from apps/star-visualization/v3.html rename to apps/embeddings/star/v3.html diff --git a/apps/embeddings/star/v4.html b/apps/embeddings/star/v4.html new file mode 100644 index 0000000..f7972f9 --- /dev/null +++ b/apps/embeddings/star/v4.html @@ -0,0 +1,395 @@ + + + + Star Visualization of Embeddings + + + + + + + + + +
+ + +
+
+ + +
+ + + + + + + + + \ No newline at end of file