File size: 509 Bytes
885870d
a41adc8
 
 
 
885870d
 
 
 
 
 
a41adc8
885870d
 
 
 
 
 
 
a41adc8
885870d
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
import face_recognition

def recognize_faces(image):
    np_img = np.array(image)
    face_locations = face_recognition.face_locations(np_img)
    
    response = f"Faces detected: {len(face_locations)}\nLocations: {face_locations}"
    return response

iface = gr.Interface(
    fn=recognize_faces, 
    inputs=gr.Image(type="numpy"), 
    outputs="text",
    title="Face Recognition App",
    description="Upload an image to detect faces."
)

iface.launch()