Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,9 +20,18 @@ with gr.Blocks() as demo:
|
|
| 20 |
chat_input.submit(chat, chat_input, chat_output)
|
| 21 |
|
| 22 |
with gr.Column():
|
| 23 |
-
video = gr.Video(label="Seu vídeo", mirror_webcam=True)
|
| 24 |
gr.Markdown("Clique no botão abaixo para iniciar sua câmera")
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
demo.launch(share=True)
|
|
|
|
| 20 |
chat_input.submit(chat, chat_input, chat_output)
|
| 21 |
|
| 22 |
with gr.Column():
|
|
|
|
| 23 |
gr.Markdown("Clique no botão abaixo para iniciar sua câmera")
|
| 24 |
+
webcam_html = """
|
| 25 |
+
<video id='webcam' autoplay playsinline style='width: 100%;'></video>
|
| 26 |
+
<button onclick='startWebcam()'>Iniciar câmera</button>
|
| 27 |
+
<script>
|
| 28 |
+
async function startWebcam() {
|
| 29 |
+
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
|
| 30 |
+
const video = document.getElementById('webcam');
|
| 31 |
+
video.srcObject = stream;
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
"""
|
| 35 |
+
gr.HTML(webcam_html)
|
| 36 |
|
| 37 |
demo.launch(share=True)
|