garg-aayush
commited on
Commit
·
d2a76eb
1
Parent(s):
352460f
update handler file
Browse files- handler.py +3 -2
handler.py
CHANGED
@@ -43,10 +43,11 @@ class EndpointHandler:
|
|
43 |
# Convert RGB to BGR (PIL uses RGB, OpenCV expects BGR)
|
44 |
opencv_image = cv2.cvtColor(opencv_image, cv2.COLOR_RGB2BGR)
|
45 |
output, _ = self.model.enhance(opencv_image, outscale=outscale)
|
46 |
-
|
|
|
|
|
47 |
img_byte_arr = BytesIO()
|
48 |
output = Image.fromarray(output)
|
49 |
-
print(output.size)
|
50 |
output.save(img_byte_arr, format='PNG')
|
51 |
img_str = base64.b64encode(img_byte_arr.getvalue())
|
52 |
return {"out_image": img_str.decode()}
|
|
|
43 |
# Convert RGB to BGR (PIL uses RGB, OpenCV expects BGR)
|
44 |
opencv_image = cv2.cvtColor(opencv_image, cv2.COLOR_RGB2BGR)
|
45 |
output, _ = self.model.enhance(opencv_image, outscale=outscale)
|
46 |
+
# BGR to RGB
|
47 |
+
output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
48 |
+
|
49 |
img_byte_arr = BytesIO()
|
50 |
output = Image.fromarray(output)
|
|
|
51 |
output.save(img_byte_arr, format='PNG')
|
52 |
img_str = base64.b64encode(img_byte_arr.getvalue())
|
53 |
return {"out_image": img_str.decode()}
|