File size: 542 Bytes
cf381c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import cv2
import numpy as np

def process_image(img):
    # Process the image and overlay it onto the background
    img = cv2.resize(img, (480, 360))
    background = cv2.imread('background.png')  # This should be the path to your background image
    background[110:110+360, 26:26+480] = img
    return background

iface = gr.Interface(
    fn=process_image,
    inputs=gr.inputs.Image(shape=(360, 480), source="webcam"),
    outputs="image",
    live=True,
)

if __name__ == "__main__":
    iface.launch(inline=False)