Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -72,18 +72,12 @@ async def camera_picture_api(
|
|
| 72 |
|
| 73 |
# check detect people or not
|
| 74 |
if out_img is None:
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
}
|
| 82 |
-
else:
|
| 83 |
-
return {
|
| 84 |
-
"status": "No face detected",
|
| 85 |
-
"image": None
|
| 86 |
-
}
|
| 87 |
else:
|
| 88 |
if ZIP:
|
| 89 |
image_bot_path = pil_to_base64(out_img, encode=False)
|
|
@@ -128,38 +122,26 @@ async def camera_picture_api(
|
|
| 128 |
print("Total time", time.time() - total_time)
|
| 129 |
return {
|
| 130 |
"status": "New people",
|
|
|
|
|
|
|
| 131 |
"image": image_bot_path
|
| 132 |
}
|
| 133 |
elif most_close < area_threshold:
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
}
|
| 142 |
-
else:
|
| 143 |
-
print("Total time", time.time() - total_time)
|
| 144 |
-
return {
|
| 145 |
-
"status": "People far from camera",
|
| 146 |
-
"image": image_bot_path,
|
| 147 |
-
}
|
| 148 |
else:
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
}
|
| 157 |
-
else:
|
| 158 |
-
print("Total time", time.time() - total_time)
|
| 159 |
-
return {
|
| 160 |
-
"status": "Old people",
|
| 161 |
-
"image": image_bot_path,
|
| 162 |
-
}
|
| 163 |
|
| 164 |
|
| 165 |
@app.post("/human_input/")
|
|
|
|
| 72 |
|
| 73 |
# check detect people or not
|
| 74 |
if out_img is None:
|
| 75 |
+
return {
|
| 76 |
+
"status": "No face detected",
|
| 77 |
+
"text": None,
|
| 78 |
+
"voice": None,
|
| 79 |
+
"image": None
|
| 80 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
else:
|
| 82 |
if ZIP:
|
| 83 |
image_bot_path = pil_to_base64(out_img, encode=False)
|
|
|
|
| 122 |
print("Total time", time.time() - total_time)
|
| 123 |
return {
|
| 124 |
"status": "New people",
|
| 125 |
+
"text": default_bot_voice,
|
| 126 |
+
"voice": None,
|
| 127 |
"image": image_bot_path
|
| 128 |
}
|
| 129 |
elif most_close < area_threshold:
|
| 130 |
+
print("Total time", time.time() - total_time)
|
| 131 |
+
return {
|
| 132 |
+
"status": "People far from camera",
|
| 133 |
+
"text": None,
|
| 134 |
+
"voice": None,
|
| 135 |
+
"image": image_bot_path,
|
| 136 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
else:
|
| 138 |
+
print("Total time", time.time() - total_time)
|
| 139 |
+
return {
|
| 140 |
+
"status": "Old people",
|
| 141 |
+
"text": None,
|
| 142 |
+
"voice": None,
|
| 143 |
+
"image": image_bot_path,
|
| 144 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
@app.post("/human_input/")
|