Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,9 @@ import os
|
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
import streamlit as st
|
|
|
|
| 5 |
from insightface.app import FaceAnalysis
|
|
|
|
| 6 |
from glob import glob
|
| 7 |
from tqdm import tqdm
|
| 8 |
from streamlit_webrtc import webrtc_streamer, VideoTransformerBase
|
|
@@ -54,6 +56,9 @@ class FaceRecognitionTransformer(VideoTransformerBase):
|
|
| 54 |
cv2.rectangle(frame, (bbox[0], bbox[1]), (bbox[2], bbox[3]), (0, 255, 0), 2)
|
| 55 |
# Write recognized name within the bounding box
|
| 56 |
cv2.putText(frame, recognized_name, (bbox[0], bbox[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
return frame
|
| 59 |
|
|
|
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
import streamlit as st
|
| 5 |
+
import insightface
|
| 6 |
from insightface.app import FaceAnalysis
|
| 7 |
+
from insightface.data import get_image as ins_get_image
|
| 8 |
from glob import glob
|
| 9 |
from tqdm import tqdm
|
| 10 |
from streamlit_webrtc import webrtc_streamer, VideoTransformerBase
|
|
|
|
| 56 |
cv2.rectangle(frame, (bbox[0], bbox[1]), (bbox[2], bbox[3]), (0, 255, 0), 2)
|
| 57 |
# Write recognized name within the bounding box
|
| 58 |
cv2.putText(frame, recognized_name, (bbox[0], bbox[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
| 59 |
+
|
| 60 |
+
# Debug print
|
| 61 |
+
print("Detected face:", recognized_name, "with confidence:", max_score)
|
| 62 |
|
| 63 |
return frame
|
| 64 |
|