AI Bee Health


// Handle the input change (when user selects a file) input.onchange = async (event) => { const file = event.target.files[0]; // Get the selected file if (!file) { alert('No file selected!'); return; }

const formData = new FormData(); formData.append('file', file);

try { // Upload the video to FastAPI server const response = await fetch('http://localhost:8000/upload/', { method: 'POST', body: formData });

const result = await response.json(); const videoUrl = result.url;

// Display the uploaded video in the media container const mediaContainer = document.querySelector('#media-container'); mediaContainer.innerHTML = ` `; } catch (error) { console.error('Error uploading video:', error); alert('Upload failed. Check console for details.'); } };

// Trigger the file input dialog input.click(); });