Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,18 +21,15 @@ def predict(image):
|
|
| 21 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 22 |
print("converted the colour to RGB.")
|
| 23 |
|
| 24 |
-
# img_tensor = transform(image).unsqueeze(0) # Add batch dimension
|
| 25 |
-
|
| 26 |
-
# # Make prediction
|
| 27 |
-
# with torch.no_grad():
|
| 28 |
-
# output = model(img_tensor)
|
| 29 |
-
|
| 30 |
# Process output (adjust based on your model's format)
|
| 31 |
results = model(image)
|
| 32 |
print("ran the model")
|
| 33 |
annotated_img = results[0].plot()
|
| 34 |
print("got annotated img")
|
| 35 |
print("type annotated img:", type(annotated_img))
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
return annotated_img
|
| 38 |
|
|
|
|
| 21 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 22 |
print("converted the colour to RGB.")
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Process output (adjust based on your model's format)
|
| 25 |
results = model(image)
|
| 26 |
print("ran the model")
|
| 27 |
annotated_img = results[0].plot()
|
| 28 |
print("got annotated img")
|
| 29 |
print("type annotated img:", type(annotated_img))
|
| 30 |
+
|
| 31 |
+
annotated_img = cv2.cvtColor(annotated_img, cv2.COLOR_RGB2BGR)
|
| 32 |
+
print("converted the colour to BGR.")
|
| 33 |
|
| 34 |
return annotated_img
|
| 35 |
|