Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,17 +10,31 @@ import transformers
|
|
| 10 |
from PIL import Image
|
| 11 |
import requests
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
from deeplabcut.utils import auxiliaryfunctions
|
| 14 |
from dlclibrary.dlcmodelzoo.modelzoo_download import (
|
| 15 |
download_huggingface_model,
|
| 16 |
MODELOPTIONS,
|
| 17 |
)
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
model = 'superanimal_topviewmouse'
|
| 20 |
train_dir = 'DLC_models/sa-tvm'
|
| 21 |
download_huggingface_model(model, train_dir)
|
| 22 |
|
| 23 |
-
#demo data cooco cat:
|
| 24 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 25 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 26 |
|
|
|
|
| 10 |
from PIL import Image
|
| 11 |
import requests
|
| 12 |
|
| 13 |
+
from viz_utils import save_results_as_json, draw_keypoints_on_image, draw_bbox_w_text, save_results_only_dlc
|
| 14 |
+
from detection_utils import predict_md, crop_animal_detections
|
| 15 |
+
from ui_utils import gradio_inputs_for_MD_DLC, gradio_outputs_for_MD_DLC, gradio_description_and_examples
|
| 16 |
+
|
| 17 |
from deeplabcut.utils import auxiliaryfunctions
|
| 18 |
from dlclibrary.dlcmodelzoo.modelzoo_download import (
|
| 19 |
download_huggingface_model,
|
| 20 |
MODELOPTIONS,
|
| 21 |
)
|
| 22 |
|
| 23 |
+
# megadetector and dlc model look up
|
| 24 |
+
MD_models_dict = {'md_v5a': "MD_models/md_v5a.0.0.pt", #
|
| 25 |
+
'md_v5b': "MD_models/md_v5b.0.0.pt"}
|
| 26 |
+
|
| 27 |
+
# DLC models target dirs
|
| 28 |
+
DLC_models_dict = {'superanimal_topviewmouse': "DLC_models/sa-tvm",
|
| 29 |
+
'superanimal_quadreped': "DLC_models/sa-q",
|
| 30 |
+
'full_human': "DLC_models/DLC_human_dancing/"}
|
| 31 |
+
|
| 32 |
+
# download the SuperAnimal models:
|
| 33 |
model = 'superanimal_topviewmouse'
|
| 34 |
train_dir = 'DLC_models/sa-tvm'
|
| 35 |
download_huggingface_model(model, train_dir)
|
| 36 |
|
| 37 |
+
# grab demo data cooco cat:
|
| 38 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 39 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
|