Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,34 @@ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
|
| 39 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
|
|
|
|
| 39 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
|
| 41 |
|
| 42 |
+
#####################################################
|
| 43 |
+
def predict_pipeline(img_input,
|
| 44 |
+
mega_model_input,
|
| 45 |
+
dlc_model_input_str,
|
| 46 |
+
flag_dlc_only,
|
| 47 |
+
flag_show_str_labels,
|
| 48 |
+
bbox_likelihood_th,
|
| 49 |
+
kpts_likelihood_th,
|
| 50 |
+
font_style,
|
| 51 |
+
font_size,
|
| 52 |
+
keypt_color,
|
| 53 |
+
marker_size,
|
| 54 |
+
):
|
| 55 |
|
| 56 |
+
if not flag_dlc_only:
|
| 57 |
+
############################################################
|
| 58 |
+
# ### Run Megadetector
|
| 59 |
+
md_results = predict_md(img_input,
|
| 60 |
+
MD_models_dict[mega_model_input], #mega_model_input,
|
| 61 |
+
size=640) #Image.fromarray(results.imgs[0])
|
| 62 |
+
|
| 63 |
+
################################################################
|
| 64 |
+
# Obtain animal crops for bboxes with confidence above th
|
| 65 |
+
list_crops = crop_animal_detections(img_input,
|
| 66 |
+
md_results,
|
| 67 |
+
bbox_likelihood_th)
|
| 68 |
+
|
| 69 |
+
############################################################
|
| 70 |
|
| 71 |
|
| 72 |
|