INNER CODE UNIT · Python

resize

instavm/clickclickclick · clickclickclick/finder/__init__.py:40

    def resize(self, image, new_size):
        if new_size:
            target_width, target_height = new_size, new_size
            resized_image = image.resize((target_width, target_height), Image.Resampling.LANCZOS)
            segments = [(resized_image, (0, 0, target_width, target_height))]
            total_width, total_height = target_width, target_height
        return segments, total_width, total_height

    @abstractmethod
    def process_segment(self, segment, model, prompt):
        pass

    def find_element(self, prompt, observation: str) -> str:
        new_size = self.IMAGE_WIDTH  # assuming square image size
        logger.info(prompt)
        screenshot = self.executor.screenshot(observation, False, True)
        image = Image.open(screenshot)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…