Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
# Built from https://huggingface.co/spaces/hlydecker/MegaDetector_v5
|
2 |
-
# Built from https://huggingface.co/spaces/sofmi/MegaDetector_DLClive/blob/main/app.py
|
3 |
-
# Built from https://huggingface.co/spaces/Neslihan/megadetector_dlcmodels/blob/main/app.py
|
4 |
-
|
5 |
import os
|
6 |
import yaml
|
7 |
import numpy as np
|
@@ -9,24 +5,27 @@ from matplotlib import cm
|
|
9 |
import gradio as gr
|
10 |
import deeplabcut
|
11 |
import dlclib
|
12 |
-
|
13 |
-
from PIL import Image, ImageColor, ImageFont, ImageDraw
|
14 |
-
# check git lfs pull!!
|
15 |
-
from DLC_models.download_utils import DownloadModel
|
16 |
-
from dlclive import DLCLive, Processor
|
17 |
|
18 |
|
|
|
19 |
from viz_utils import save_results_as_json, draw_keypoints_on_image, draw_bbox_w_text, save_results_only_dlc
|
20 |
from detection_utils import predict_md, crop_animal_detections, predict_dlc
|
21 |
from ui_utils import gradio_inputs_for_MD_DLC, gradio_outputs_for_MD_DLC, gradio_description_and_examples
|
22 |
|
23 |
-
# directly from huggingface
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
model = gr.Interface.load("mwmathis/DeepLabCutModelZoo-SuperAnimal-Quadruped",
|
28 |
-
)
|
29 |
|
30 |
-
model.launch()
|
31 |
|
32 |
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import yaml
|
3 |
import numpy as np
|
|
|
5 |
import gradio as gr
|
6 |
import deeplabcut
|
7 |
import dlclib
|
8 |
+
import transformers
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
+
from PIL import Image, ImageColor, ImageFont, ImageDraw
|
12 |
from viz_utils import save_results_as_json, draw_keypoints_on_image, draw_bbox_w_text, save_results_only_dlc
|
13 |
from detection_utils import predict_md, crop_animal_detections, predict_dlc
|
14 |
from ui_utils import gradio_inputs_for_MD_DLC, gradio_outputs_for_MD_DLC, gradio_description_and_examples
|
15 |
|
|
|
16 |
|
17 |
+
# Load the model
|
18 |
+
model = transformers.AutoModel.from_pretrained("mwmathis/DeepLabCutModelZoo-SuperAnimal-Quadruped")
|
19 |
+
|
20 |
+
# Create an instance of the model
|
21 |
+
inference_api = transformers.InferenceAPI(model)
|
22 |
+
|
23 |
+
# Make a prediction with the model
|
24 |
+
prediction = inference_api.predict(inputs=["This is a sample input."])
|
25 |
+
|
26 |
+
# Print the prediction
|
27 |
+
print(prediction)
|
28 |
|
|
|
|
|
29 |
|
|
|
30 |
|
31 |
|