Spaces:
Sleeping
Sleeping
function loadModel(modelName) { | |
var iframe = document.getElementById("model-iframe"); | |
var url; | |
// Define the URLs for each model | |
if (modelName === 'classification') { | |
url = "classification.html"; | |
} else if (modelName === 'generation') { | |
url = "generation.html"; | |
} | |
// Set the src attribute of the iframe | |
iframe.innerHTML = '<iframe src="' + url + '" style="width: 100%; height:30em"; frameborder="0" ></iframe>'; | |
// Remove the "is-active" class from all main-header-link elements | |
var headerLinks = document.getElementsByClassName("main-header-link"); | |
for (var i = 0; i < headerLinks.length; i++) { | |
headerLinks[i].classList.remove("is-active"); | |
} | |
// Add the "is-active" class to the clicked link | |
var clickedLink = document.querySelector('.main-header-link[onclick="loadModel(\'' + modelName + '\')"]'); | |
clickedLink.classList.add("is-active"); | |
} | |
// Call loadModel with the default model when the page is loaded | |
window.onload = function() { | |
loadModel('classification', 'clsification'); // Replace 'linear' with the desired default model | |
}; | |
// Add event listener to the submit button | |
document.getElementById("classification-form").addEventListener("submit", function() { | |
// Show the loader | |
document.getElementById("loader").style.display = "block"; | |
}); | |
function validateForm() { | |
var radios = document.getElementsByName('valueradio'); | |
var isChecked = false; | |
for (var i = 0; i < radios.length; i++) { | |
if (radios[i].checked) { | |
isChecked = true; | |
break; | |
} | |
} | |
if (!isChecked) { | |
alert('Please select the number of words.'); | |
return false; | |
} | |
return true; | |
} |