Spaces:
Runtime error
Runtime error
Alex Chan
commited on
Commit
•
10fc227
1
Parent(s):
d478a6c
added example script
Browse files
app.py
CHANGED
@@ -22,6 +22,9 @@ os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
|
22 |
sys.path.append("Repositories/")
|
23 |
from dlclive import DLCLive, Processor
|
24 |
|
|
|
|
|
|
|
25 |
def run_Inference(input_img):
|
26 |
|
27 |
###Detectron:
|
@@ -38,13 +41,21 @@ def run_Inference(input_img):
|
|
38 |
dlc_proc = Processor()
|
39 |
dlc_liveObj = DLCLive("./Weights/DLC_DLC_Segmented_resnet_50_iteration-0_shuffle-1/", processor=dlc_proc)
|
40 |
|
41 |
-
OutImg = Inference.Inference(input_img,predictor,dlc_liveObj,ScaleBBox=1,Dilate=5,DLCThreshold=0.3)
|
42 |
|
43 |
return OutImg
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
demo = gr.Interface(run_Inference,
|
46 |
gr.Image(),
|
47 |
"image",
|
|
|
48 |
title="PigeonEverywhere",
|
49 |
description="Upload a photo of a pigeon, and get 2D keypoint estimation.\nFor more info on how this was done, see:https://arxiv.org/abs/2308.15316 ")
|
50 |
demo.launch()
|
|
|
22 |
sys.path.append("Repositories/")
|
23 |
from dlclive import DLCLive, Processor
|
24 |
|
25 |
+
import os
|
26 |
+
import cv2
|
27 |
+
|
28 |
def run_Inference(input_img):
|
29 |
|
30 |
###Detectron:
|
|
|
41 |
dlc_proc = Processor()
|
42 |
dlc_liveObj = DLCLive("./Weights/DLC_DLC_Segmented_resnet_50_iteration-0_shuffle-1/", processor=dlc_proc)
|
43 |
|
44 |
+
OutImg = Inference.Inference(input_img,predictor,dlc_liveObj,ScaleBBox=1.2,Dilate=5,DLCThreshold=0.3)
|
45 |
|
46 |
return OutImg
|
47 |
|
48 |
+
|
49 |
+
##Get sample images
|
50 |
+
ImgList = [os.path.join("Samples",img) for img in os.listdir("Samples")]
|
51 |
+
# for imgPath in [os.path.join("Samples",img) for img in os.listdir("Samples")]:
|
52 |
+
# frame = cv2.imread(filename=imgPath)
|
53 |
+
# ImgList.append(frame)
|
54 |
+
|
55 |
demo = gr.Interface(run_Inference,
|
56 |
gr.Image(),
|
57 |
"image",
|
58 |
+
examples=ImgList,
|
59 |
title="PigeonEverywhere",
|
60 |
description="Upload a photo of a pigeon, and get 2D keypoint estimation.\nFor more info on how this was done, see:https://arxiv.org/abs/2308.15316 ")
|
61 |
demo.launch()
|