Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,9 +20,15 @@ def gradio_wrapper(img):
|
|
| 20 |
global model
|
| 21 |
#print(np.shape(img))
|
| 22 |
results = model.predict(img) # predict on an image
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
(0, 0, 255), 2, cv2.LINE_AA, False)
|
| 27 |
# return results
|
| 28 |
|
|
|
|
| 20 |
global model
|
| 21 |
#print(np.shape(img))
|
| 22 |
results = model.predict(img) # predict on an image
|
| 23 |
+
try:
|
| 24 |
+
if max(results[0].boxes.cls) == 0:
|
| 25 |
+
text = "Man"
|
| 26 |
+
if max(results[0].boxes.cls) == 1:
|
| 27 |
+
text = "Women"
|
| 28 |
+
except:
|
| 29 |
+
pass
|
| 30 |
+
|
| 31 |
+
return cv2.putText(img, text,(00, 185), cv2.FONT_HERSHEY_SIMPLEX, 1,
|
| 32 |
(0, 0, 255), 2, cv2.LINE_AA, False)
|
| 33 |
# return results
|
| 34 |
|