File size: 569 Bytes
c1d54c1
 
 
 
 
 
f23f3de
 
 
 
 
 
 
 
c1d54c1
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import cv2
from matplotlib import pyplot as plt
import gradio as gr


def my_app(img):
    grayscale_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    classifier = cv2.CascadeClassifier('classifier.xml')
    analysedData = classifier.detectMultiScale(grayscale_image,
                                               minSize=(20, 20))
    if len(analysedData) != 0:
        return ("S T O P!")
    else:
        return ("You're good to go :)")


gr.interface.Interface(fn=my_app, live=True, inputs=gr.Image(
    source='webcam', streaming=True), outputs="text").launch()