LDanielBlueway commited on
Commit
db3681b
·
verified ·
1 Parent(s): d982eee

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +7 -0
handler.py CHANGED
@@ -33,6 +33,13 @@ class EndpointHandler():
33
  score_threshold=0.3,
34
  nms_threshold=0.3,
35
  )[0]
 
 
 
 
 
 
 
36
  return results
37
  #prediction = self.pipeline(image=[image], candidate_labels=inputs["candidates"])
38
  #return prediction[0]
 
33
  score_threshold=0.3,
34
  nms_threshold=0.3,
35
  )[0]
36
+ # Convert tensors to lists
37
+ serializable_results = {
38
+ 'boxes': results['boxes'].tolist(),
39
+ 'scores': results['scores'].tolist(),
40
+ 'labels': results['labels'].tolist(),
41
+ 'text_labels': results['text_labels'] # Already serializable
42
+ }
43
  return results
44
  #prediction = self.pipeline(image=[image], candidate_labels=inputs["candidates"])
45
  #return prediction[0]