Suraj Narayanan Sasikumar commited on
Commit
7aa9aed
1 Parent(s): 8682288

output test

Browse files
Files changed (1) hide show
  1. handler.py +10 -2
handler.py CHANGED
@@ -50,6 +50,14 @@ class EndpointHandler:
50
  height=height,
51
  width=width,
52
  )
 
 
 
 
 
53
 
54
- # return first generate PIL image
55
- return out.images[0]
 
 
 
 
50
  height=height,
51
  width=width,
52
  )
53
+
54
+ # encode image as base 64
55
+ buffered = BytesIO()
56
+ out.images[0].save(buffered, format="JPEG")
57
+ img_str = base64.b64encode(buffered.getvalue())
58
 
59
+ # postprocess the prediction
60
+ return {"image": img_str.decode()}
61
+
62
+ # # return first generate PIL image
63
+ # return out.images[0]