Spaces:
Runtime error
Runtime error
HuggingFace-SK commited on
Commit ·
33d277b
1
Parent(s): 17c3f55
style flip camera btn
Browse files26 unmodified lines272829303132333412 unmodified lines47484950515253545593 unmodified lines14915015115215315415515615715815916016116216316416516614 unmodified lines1811821831841851861879 unmodified lines19719819920020120220326 unmodified lines<div class="container"><video id="webcam" style="display:none" autoplay="" playsinline=""></video><div class="canvas_wrapper" id="canvas_wrapper"><canvas class="output_canvas" id="output_canvas" width="100%" height="300%"></canvas><center><button id="webcamButton">12 unmodified lines<button id="text-to-speech" onclick="speak(document.getElementById('text').value)"><span>Listen to the text 🔊</span></button><button id="switch-camera"><span>Switch CM</span></button></div><center><script>93 unmodified lineselse {console.warn("getUserMedia() is not supported by your browser");}async function switch_camera(){if (video_facing_mode=='user'){webcamRunning= falsevideo_facing_mode = 'environment'await load_camera()webcamRunning= true}else{webcamRunning = falsevideo_facing_mode = 'user'await load_camera()webcamRunning= true}}// Enable the live webcam view and start detection.14 unmodified lines// getUsermedia parameters.load_camera()}function load_camera(){const constraints = {video: {facingMode: video_facing_mode9 unmodified lineslet results = undefined;console.log(video);async function predictWebcam() {if (video.videoHeight == 0){return}canvasElement.width = window.innerWidth;26 unmodified lines2728293031323334353637383912 unmodified lines5253545556575893 unmodified lines15215315415515615715815916016116216316416516616716816914 unmodified lines1841851861871881891909 unmodified lines20020120220320420520626 unmodified lines<div class="container"><video id="webcam" style="display:none" autoplay="" playsinline=""></video><div class="canvas_wrapper" id="canvas_wrapper"><button id="switch-camera" style="position: absolute; top:10px; left:10px; padding:5px; height:40px; width:40px; text-align: center; border-radius: 12.25px; font-size: 20px; font-weight: 900; border:none; background-color: #f2f2f2;box-shadow: 0px 4px 20px 4px rgba(0, 0, 0, 0.38); z-index:100"><span>⟳</span></button><canvas class="output_canvas" id="output_canvas" width="100%" height="300%"></canvas><center><button id="webcamButton">12 unmodified lines<button id="text-to-speech" onclick="speak(document.getElementById('text').value)"><span>Listen to the text 🔊</span></button></div><center><script>93 unmodified lineselse {console.warn("getUserMedia() is not supported by your browser");}async function switch_camera() {if (video_facing_mode == 'user') {webcamRunning = falsevideo_facing_mode = 'environment'await load_camera()webcamRunning = true}else {webcamRunning = falsevideo_facing_mode = 'user'await load_camera()webcamRunning = true}}// Enable the live webcam view and start detection.14 unmodified lines// getUsermedia parameters.load_camera()}function load_camera() {const constraints = {video: {facingMode: video_facing_mode9 unmodified lineslet results = undefined;console.log(video);async function predictWebcam() {if (video.videoHeight == 0) {return}canvasElement.width = window.innerWidth;
templates/browser-detect.html+14-11