mulasagg's picture
gradio
3153a1f
raw
history blame contribute delete
478 Bytes
import gradio as gr
import cv2
import numpy as np
def apply_filter(frame):
# frame is a numpy array (H, W, 3) in RGB
img = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Example filter: invert colors
img = cv2.bitwise_not(img)
# Convert back to RGB for display
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
iface = gr.Interface(
fn=apply_filter,
inputs=gr.Video(source="webcam", streaming=True),
outputs="video",
live=True,
)
iface.launch()