import cv2 import requests from services.clock_service import ClockService from services.detection_service import DetectionService class GameService: detection_service : DetectionService clock_service : ClockService def __init__(self): self.detection_service = DetectionService() self.clock_service = ClockService() def start(self, time_control : int, increment : int ) -> None: self.clock_service.start(time_control, increment) self.clock_service.set_on_terminated(self.stop) def stop(self): self.clock_service.stop() self.detection_service.stop() def make_move(self) -> None: img, fen = self.detection_service.analyze_single_frame() print(fen) encoded_frame = cv2.imencode('.jpg', img) image_bytes = encoded_frame[1].tobytes() headers = {'Content-Type': 'image/jpeg'} response = requests.post("https://192.168.15.125:1880/party/image", data=image_bytes, headers=headers) print(response.status_code)