File size: 1,734 Bytes
ed9f15f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**

 * Quick Evaluation Handler - Quick analysis workflow

 */

import { evaluateEmbryo } from '../models/inference.js';
import { showToast } from '../ui/toast.js';
import { displayQuickResults } from '../ui/results.js';

/**

 * Quick analyze button handler

 */
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');
    }
}

/**

 * Clear quick evaluation

 */
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;
}