Spaces:
Running
Running
Abhishek Gola
commited on
Commit
·
96c2a9f
1
Parent(s):
d828c23
updated app.py
Browse files
app.py
CHANGED
@@ -41,12 +41,16 @@ def visualize(image, results, box_color=(0, 255, 0), text_color=(0, 0, 255)):
|
|
41 |
return output
|
42 |
|
43 |
def detect_faces(input_image):
|
|
|
44 |
h, w, _ = input_image.shape
|
45 |
model.setInputSize([w, h])
|
46 |
results = model.infer(input_image)
|
47 |
if results is None or len(results) == 0:
|
|
|
48 |
return input_image
|
49 |
-
|
|
|
|
|
50 |
|
51 |
# Gradio Interface
|
52 |
demo = gr.Interface(
|
|
|
41 |
return output
|
42 |
|
43 |
def detect_faces(input_image):
|
44 |
+
input_image = cv.cvtColor(input_image, cv.COLOR_RGB2BGR)
|
45 |
h, w, _ = input_image.shape
|
46 |
model.setInputSize([w, h])
|
47 |
results = model.infer(input_image)
|
48 |
if results is None or len(results) == 0:
|
49 |
+
input_image = cv.cvtColor(input_image, cv.COLOR_BGR2RGB)
|
50 |
return input_image
|
51 |
+
output = visualize(input_image, results)
|
52 |
+
output = cv.cvtColor(output, cv.COLOR_BGR2RGB)
|
53 |
+
return output
|
54 |
|
55 |
# Gradio Interface
|
56 |
demo = gr.Interface(
|