Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -91,7 +91,15 @@ def dbc2sbc(s):
|
|
91 |
return rs
|
92 |
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
def np2base64(image_np):
|
|
|
95 |
image = cv2.imencode('.jpg', image_np)[1]
|
96 |
base64_str = str(base64.b64encode(image))[2:-1]
|
97 |
return base64_str
|
|
|
91 |
return rs
|
92 |
|
93 |
|
94 |
+
def BGR2RGB(img):
|
95 |
+
pilimg = img.copy()
|
96 |
+
pilimg[:, :, 0] = img[:, :, 2]
|
97 |
+
pilimg[:, :, 2] = img[:, :, 0]
|
98 |
+
return pilimg
|
99 |
+
|
100 |
+
|
101 |
def np2base64(image_np):
|
102 |
+
image_np = BGR2RGB(image_np)
|
103 |
image = cv2.imencode('.jpg', image_np)[1]
|
104 |
base64_str = str(base64.b64encode(image))[2:-1]
|
105 |
return base64_str
|