import cv2 import gradio as gr from spoofynet import SpoofyNet spoofynet = SpoofyNet() def find_spoofs(input_img): spoofs = spoofynet.find_spoof(input_img) for spoof in spoofs: (startX, startY, endX, endY) = spoof["coords"] label = "Real" if spoof["is_real"] else "Spoofed" color = (0, 255, 0) if spoof["is_real"] else (0, 0, 255) cv2.putText( input_img, f"{label}: {spoof['probs']:.2f}", (startX, startY - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2, ) cv2.rectangle(input_img, (startX, startY), (endX, endY), color, 4) return input_img demo = gr.Interface(find_spoofs, gr.Image(), "image") demo.launch()