|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { evaluateEmbryo } from '../models/inference.js';
|
|
|
import { showToast } from '../ui/toast.js';
|
|
|
import { displayQuickResults } from '../ui/results.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function quickAnalyze() {
|
|
|
const img = document.getElementById('quickImage');
|
|
|
if (!img || !img.src) return;
|
|
|
|
|
|
try {
|
|
|
showToast('Analyzing embryo...', 'info');
|
|
|
|
|
|
const result = await evaluateEmbryo(img.src);
|
|
|
displayQuickResults(result);
|
|
|
|
|
|
showToast('Analysis complete!', 'success');
|
|
|
} catch (error) {
|
|
|
console.error('Quick analysis error:', error);
|
|
|
showToast(`Analysis failed: ${error.message}`, 'error');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function clearQuickEvaluation() {
|
|
|
const img = document.getElementById('quickImage');
|
|
|
const preview = document.getElementById('quickImagePreview');
|
|
|
const resultsDiv = document.getElementById('quickResults');
|
|
|
const predictionsDiv = document.getElementById('quickPredictions');
|
|
|
const input = document.getElementById('quickImageInput');
|
|
|
const analyzeBtn = document.getElementById('quickAnalyzeBtn');
|
|
|
|
|
|
if (img) img.style.display = 'none';
|
|
|
if (preview) {
|
|
|
const placeholder = preview.querySelector('.placeholder');
|
|
|
if (placeholder) placeholder.style.display = 'flex';
|
|
|
}
|
|
|
if (resultsDiv) resultsDiv.innerHTML = '<p>Upload and analyze an embryo image to see detailed grading results.</p>';
|
|
|
if (predictionsDiv) predictionsDiv.innerHTML = '';
|
|
|
if (input) input.value = '';
|
|
|
if (analyzeBtn) analyzeBtn.disabled = true;
|
|
|
}
|
|
|
|