Spaces:
Sleeping
Sleeping
File size: 639 Bytes
6ddbe7b f53b5f0 f6ffe02 204de8c 6ddbe7b 204de8c 6ddbe7b 204de8c 6ddbe7b 204de8c 6ddbe7b 204de8c d9a38cf 204de8c |
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 |
import cv2
import gradio as gr
def video_stream(ip_url):
cap = cv2.VideoCapture(ip_url)
while True:
ret, frame = cap.read()
if not ret:
break
_, jpeg = cv2.imencode(".jpg", frame)
yield jpeg.tobytes()
def start_stream(ip_url):
return gr.update(value=video_stream(ip_url))
# Create Gradio Interface
with gr.Blocks() as demo:
ip_input = gr.Textbox(label="Enter IP Webcam URL", value="http://100.87.48.67:8080/video")
video_output = gr.Video()
start_btn = gr.Button("Start Stream")
start_btn.click(start_stream, inputs=ip_input, outputs=video_output)
demo.launch()
|