drab commited on
Commit
c547fc5
1 Parent(s): 7bc0418

Simple debug version

Browse files
Files changed (1) hide show
  1. pipeline.py +19 -14
pipeline.py CHANGED
@@ -11,12 +11,17 @@ from PIL import Image
11
  # most of this code has been obtained from Datature's prediction script
12
  # https://github.com/datature/resources/blob/main/scripts/bounding_box/prediction.py
13
 
14
- class PreTrainedPipeline():
15
- def __init__(self, path: str):
16
- # load the model
17
- self.model = tf.saved_model.load(os.path.join(path, "saved_model"))
18
 
19
- def __call__(self, inputs: "Image.Image")-> List[Dict[str, Any]]:
 
 
 
 
 
 
 
20
 
21
  # # convert img to numpy array, resize and normalize to make the prediction
22
  # img = np.array(inputs)
@@ -76,12 +81,12 @@ class PreTrainedPipeline():
76
  # "score": 1.0,
77
  # })
78
 
79
- labels = [{"score":0.9509243965148926,"label":"car","box":{"xmin":142,"ymin":106,"xmax":376,"ymax":229}},
80
- {"score":0.9981777667999268,"label":"car","box":{"xmin":405,"ymin":146,"xmax":640,"ymax":297}},
81
- {"score":0.9963648915290833,"label":"car","box":{"xmin":0,"ymin":115,"xmax":61,"ymax":167}},
82
- {"score":0.974663257598877,"label":"car","box":{"xmin":155,"ymin":104,"xmax":290,"ymax":141}},
83
- {"score":0.9986898303031921,"label":"car","box":{"xmin":39,"ymin":117,"xmax":169,"ymax":188}},
84
- {"score":0.9998276233673096,"label":"person","box":{"xmin":172,"ymin":60,"xmax":482,"ymax":396}},
85
- {"score":0.9996274709701538,"label":"skateboard","box":{"xmin":265,"ymin":348,"xmax":440,"ymax":413}}]
86
-
87
- return labels
 
11
  # most of this code has been obtained from Datature's prediction script
12
  # https://github.com/datature/resources/blob/main/scripts/bounding_box/prediction.py
13
 
14
+ def load_model():
15
+ return tf.saved_model.load('./saved_model')
 
 
16
 
17
+ model = load_model()
18
+
19
+ # class PreTrainedPipeline():
20
+ # def __init__(self, path: str):
21
+ # # load the model
22
+ # self.model = tf.saved_model.load(os.path.join(path, "saved_model"))
23
+
24
+ # def __call__(self, inputs: "Image.Image")-> List[Dict[str, Any]]:
25
 
26
  # # convert img to numpy array, resize and normalize to make the prediction
27
  # img = np.array(inputs)
 
81
  # "score": 1.0,
82
  # })
83
 
84
+ labels = [{"score":0.9509243965148926,"label":"car","box":{"xmin":142,"ymin":106,"xmax":376,"ymax":229}},
85
+ {"score":0.9981777667999268,"label":"car","box":{"xmin":405,"ymin":146,"xmax":640,"ymax":297}},
86
+ {"score":0.9963648915290833,"label":"car","box":{"xmin":0,"ymin":115,"xmax":61,"ymax":167}},
87
+ {"score":0.974663257598877,"label":"car","box":{"xmin":155,"ymin":104,"xmax":290,"ymax":141}},
88
+ {"score":0.9986898303031921,"label":"car","box":{"xmin":39,"ymin":117,"xmax":169,"ymax":188}},
89
+ {"score":0.9998276233673096,"label":"person","box":{"xmin":172,"ymin":60,"xmax":482,"ymax":396}},
90
+ {"score":0.9996274709701538,"label":"skateboard","box":{"xmin":265,"ymin":348,"xmax":440,"ymax":413}}]
91
+
92
+ return labels