IndentationError

This commit is contained in:
2024-10-20 19:06:33 +11:00
parent c948bdfd6c
commit fe209a9c2a
+10 -6
View File
@@ -89,7 +89,7 @@ async def process_snapshot(client, payload):
# Attempt to read the saved image with OpenCV
image = cv2.imread(temp_image_path)
if image is not None:
if image is not None:
rating = calculate_dayglo_rating(image)
print("Dayglo Rating calculated:", rating)
await publish_rating(client, rating)
@@ -118,17 +118,21 @@ async def main():
print("Starting Dayglo Detector...")
# Handle command line argument for image file
if len(sys.argv) > 1:
image_file = sys.argv[1]
image_file = sys.argv[1]
if os.path.exists(image_file):
print(f"Processing image from file: {image_file}")
client = DaygloDetectorMQTTClient("dayglo_detector")
client.set_auth_credentials(MQTT_USERNAME, MQTT_PASSWORD)
await client.connect(MQTT_BROKER, MQTT_PORT, keepalive=60)
print(f"Processing image from file: {image_file}")
image = cv2.imread(image_file)
if image is not None:
rating = calculate_dayglo_rating(image)
print("Dayglo Rating calculated from file:", rating)
else:
print("Invalid image file provided.")
await publish_rating(client, rating)
else:
print(f"File not found: {image_file}")
print("Invalid image file provided.")
else:
print(f"File not found: {image_file}")
# Set up MQTT client for normal operation
client = DaygloDetectorMQTTClient("dayglo_detector")