Embryo-One's picture
Upload 49 files
ed9f15f verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Model Test</title>
</head>
<body>
<h1>Testing Model Loading...</h1>
<div id="status">Initializing...</div>
<div id="results"></div>
<script type="module">
import * as ort from 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.17.0/dist/esm/ort.min.js';
const statusDiv = document.getElementById('status');
const resultsDiv = document.getElementById('results');
async function testModels() {
try {
statusDiv.textContent = 'Configuring ONNX Runtime...';
ort.env.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.17.0/dist/';
ort.env.wasm.numThreads = 4;
// Test Classifier
statusDiv.textContent = 'Loading Classifier...';
const classifier = await ort.InferenceSession.create('./models/classifier_model_compressed/model.onnx');
resultsDiv.innerHTML += '<p>βœ… Classifier loaded successfully!</p>';
// Test Quality
statusDiv.textContent = 'Loading Quality Model...';
const quality = await ort.InferenceSession.create('./models/poor_good_compressed/model.onnx');
resultsDiv.innerHTML += '<p>βœ… Quality model loaded successfully!</p>';
// Test Grader
statusDiv.textContent = 'Loading Grader...';
const grader = await ort.InferenceSession.create('./models/grader_model_compressed/model.onnx');
resultsDiv.innerHTML += '<p>βœ… Grader model loaded successfully!</p>';
// Test YOLO
statusDiv.textContent = 'Loading YOLO...';
const yolo = await ort.InferenceSession.create('./models/yolo-cropper/best.onnx');
resultsDiv.innerHTML += '<p>βœ… YOLO model loaded successfully!</p>';
statusDiv.textContent = 'βœ… All models loaded successfully!';
resultsDiv.innerHTML += '<h2>πŸŽ‰ Ready to use!</h2>';
} catch (error) {
statusDiv.textContent = '❌ Error: ' + error.message;
resultsDiv.innerHTML += '<p style="color:red;">Error: ' + error.stack + '</p>';
}
}
testModels();
</script>
</body>
</html>