|
|
<!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;
|
|
|
|
|
|
|
|
|
statusDiv.textContent = 'Loading Classifier...';
|
|
|
const classifier = await ort.InferenceSession.create('./models/classifier_model_compressed/model.onnx');
|
|
|
resultsDiv.innerHTML += '<p>β
Classifier loaded successfully!</p>';
|
|
|
|
|
|
|
|
|
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>';
|
|
|
|
|
|
|
|
|
statusDiv.textContent = 'Loading Grader...';
|
|
|
const grader = await ort.InferenceSession.create('./models/grader_model_compressed/model.onnx');
|
|
|
resultsDiv.innerHTML += '<p>β
Grader model loaded successfully!</p>';
|
|
|
|
|
|
|
|
|
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>
|
|
|
|