Spaces:
Sleeping
Sleeping
RGB to BGR
Browse files
app.py
CHANGED
|
@@ -10,7 +10,9 @@ API_URL = "https://mlops-lab3-jauregui-latest.onrender.com"
|
|
| 10 |
# Function to execute when clicking the "Predict button"
|
| 11 |
def predict(image):
|
| 12 |
try:
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
files = {"file": ("image.jpg", img_encoded.tobytes(), "image/jpeg")}
|
| 15 |
|
| 16 |
response = requests.post(f"{API_URL}/predict", files=files, timeout=120)
|
|
|
|
| 10 |
# Function to execute when clicking the "Predict button"
|
| 11 |
def predict(image):
|
| 12 |
try:
|
| 13 |
+
image_bgr = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
| 14 |
+
|
| 15 |
+
_, img_encoded = cv2.imencode(".jpg", image_bgr)
|
| 16 |
files = {"file": ("image.jpg", img_encoded.tobytes(), "image/jpeg")}
|
| 17 |
|
| 18 |
response = requests.post(f"{API_URL}/predict", files=files, timeout=120)
|