File size: 901 Bytes
e4febf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
window.addEventListener('load', (event) => {
    // Wait for Gradio interface to fully load
    const gradioAppLoaded = setInterval(() => {
        const webcamButton = document.querySelector('button[aria-label="select input source"]');
        if (webcamButton) {
            clearInterval(gradioAppLoaded);
            webcamButton.click();
            setTimeout(() => {
                const backCameraOption = Array.from(document.querySelectorAll('select option')).find(option => option.text.toLowerCase().includes('back'));
                if (backCameraOption) {
                    backCameraOption.selected = true;
                    const event = new Event('change', { bubbles: true });
                    backCameraOption.parentElement.dispatchEvent(event);
                }
            }, 500); // Adjust timeout as necessary to ensure dropdown is populated
        }
    }, 1000);
});