From 55b1c77ff87bb45c9a22111772e2e99b2c950c0f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 14:37:06 +0000 Subject: [PATCH] ci: automatic Python Formatter changes --- senju/image_reco.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/senju/image_reco.py b/senju/image_reco.py index e0f4b30..e4f45c9 100644 --- a/senju/image_reco.py +++ b/senju/image_reco.py @@ -2,12 +2,12 @@ Senju Image Recognition Module ============================= -A module providing image description generation capabilities for the Senju +A module providing image description generation capabilities for the Senju haiku application. This module leverages pre-trained vision-language models (specifically BLIP) to generate -textual descriptions of uploaded images. These descriptions can then be +textual descriptions of uploaded images. These descriptions can then be used as input for the haiku generation process, enabling image-to-haiku functionality. @@ -46,12 +46,12 @@ from transformers import BlipProcessor, BlipForConditionalGeneration class ImageDescriptionGenerator: """ - A class for generating textual descriptions of images using + A class for generating textual descriptions of images using a vision-language model. - This class handles the loading of a pre-trained BLIP model, image - preprocessing, and caption generation. It provides an interface for - converting raw image data into natural language descriptions that can + This class handles the loading of a pre-trained BLIP model, image + preprocessing, and caption generation. It provides an interface for + converting raw image data into natural language descriptions that can be used for haiku inspiration. :ivar processor: The BLIP processor for handling image inputs @@ -80,15 +80,15 @@ class ImageDescriptionGenerator: """ Generate a descriptive caption for the given image. - This method processes the raw image data, runs inference with - the BLIP model, and returns a structured response with the + This method processes the raw image data, runs inference with + the BLIP model, and returns a structured response with the generated description. :param image_data: Raw binary image data :type image_data: bytes :param max_length: Maximum token length for the generated caption :type max_length: int - :return: Dictionary containing the generated description and + :return: Dictionary containing the generated description and confidence score :rtype: dict """ @@ -127,12 +127,12 @@ def gen_response(image_data) -> dict: """ Generate a description for an image using the global description generator. - This function provides a simplified interface to the image + This function provides a simplified interface to the image description functionality for use in API endpoints. :param image_data: Raw binary image data :type image_data: bytes - :return: Dictionary containing the image description and + :return: Dictionary containing the image description and confidence information :rtype: dict :raises Exception: If image processing or description generation fails