[GH-ISSUE #9961] [ERROR: No Tools class found in the module] #54379

Closed
opened 2026-05-05 16:11:26 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @kalsolio on GitHub (Feb 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9961

from https://openwebui.com/t/acrlab/image_describer_tool/
got

Image

from transformers import BlipProcessor, BlipForConditionalGeneration
from PIL import Image
import os


# Define the main tool class
class ImageDescriber:
    def __init__(self):
        # Load the BLIP model and processor
        self.model = BlipForConditionalGeneration.from_pretrained(
            "Salesforce/blip-image-captioning-base"
        )
        self.processor = BlipProcessor.from_pretrained(
            "Salesforce/blip-image-captioning-base"
        )

    def describe_image(self, image_path):
        try:
            # Open and process the image
            image = Image.open(image_path)
            inputs = self.processor(images=image, return_tensors="pt")

            # Generate description (caption) for the image
            caption = self.model.generate(**inputs)
            description = self.processor.decode(caption[0], skip_special_tokens=True)
            return description
        except Exception as e:
            return f"Error processing image: {str(e)}"


# Define the entry point for the tool
def main(image_path):
    tool = ImageDescriber()
    description = tool.describe_image(image_path)
    return {"description": description}

Image

Originally created by @kalsolio on GitHub (Feb 14, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/9961 from https://openwebui.com/t/acrlab/image_describer_tool/ got ![Image](https://github.com/user-attachments/assets/60a5a47f-9e68-41d5-a203-8d056b59447e) ``` from transformers import BlipProcessor, BlipForConditionalGeneration from PIL import Image import os # Define the main tool class class ImageDescriber: def __init__(self): # Load the BLIP model and processor self.model = BlipForConditionalGeneration.from_pretrained( "Salesforce/blip-image-captioning-base" ) self.processor = BlipProcessor.from_pretrained( "Salesforce/blip-image-captioning-base" ) def describe_image(self, image_path): try: # Open and process the image image = Image.open(image_path) inputs = self.processor(images=image, return_tensors="pt") # Generate description (caption) for the image caption = self.model.generate(**inputs) description = self.processor.decode(caption[0], skip_special_tokens=True) return description except Exception as e: return f"Error processing image: {str(e)}" # Define the entry point for the tool def main(image_path): tool = ImageDescriber() description = tool.describe_image(image_path) return {"description": description} ``` ![Image](https://github.com/user-attachments/assets/f66ac0b8-656a-47ff-845c-4c93a91cb551)
Author
Owner

@tjbck commented on GitHub (Feb 14, 2025):

Not a valid tool.

<!-- gh-comment-id:2658152010 --> @tjbck commented on GitHub (Feb 14, 2025): Not a valid tool.
Author
Owner

@zhailianxing commented on GitHub (Mar 21, 2025):

Not a valid tool.

I download the "Chat with Csv" tool from community, when I import this tool to my local openWebui, why this error also happen?

Image

Image

<!-- gh-comment-id:2742479932 --> @zhailianxing commented on GitHub (Mar 21, 2025): > Not a valid tool. I download the "Chat with Csv" tool from community, when I import this tool to my local openWebui, why this error also happen? ![Image](https://github.com/user-attachments/assets/32b72f50-d749-4bda-95e6-b1de05abb103) ![Image](https://github.com/user-attachments/assets/31261f8b-4f9d-4759-a415-b3fdde16fe97)
Author
Owner

@zhailianxing commented on GitHub (Mar 21, 2025):

from https://openwebui.com/t/acrlab/image_describer_tool/ got

Image

from transformers import BlipProcessor, BlipForConditionalGeneration
from PIL import Image
import os


# Define the main tool class
class ImageDescriber:
    def __init__(self):
        # Load the BLIP model and processor
        self.model = BlipForConditionalGeneration.from_pretrained(
            "Salesforce/blip-image-captioning-base"
        )
        self.processor = BlipProcessor.from_pretrained(
            "Salesforce/blip-image-captioning-base"
        )

    def describe_image(self, image_path):
        try:
            # Open and process the image
            image = Image.open(image_path)
            inputs = self.processor(images=image, return_tensors="pt")

            # Generate description (caption) for the image
            caption = self.model.generate(**inputs)
            description = self.processor.decode(caption[0], skip_special_tokens=True)
            return description
        except Exception as e:
            return f"Error processing image: {str(e)}"


# Define the entry point for the tool
def main(image_path):
    tool = ImageDescriber()
    description = tool.describe_image(image_path)
    return {"description": description}

Image

do you konw how to slove this problem?

<!-- gh-comment-id:2742486362 --> @zhailianxing commented on GitHub (Mar 21, 2025): > from https://openwebui.com/t/acrlab/image_describer_tool/ got > > ![Image](https://github.com/user-attachments/assets/60a5a47f-9e68-41d5-a203-8d056b59447e) > > ``` > from transformers import BlipProcessor, BlipForConditionalGeneration > from PIL import Image > import os > > > # Define the main tool class > class ImageDescriber: > def __init__(self): > # Load the BLIP model and processor > self.model = BlipForConditionalGeneration.from_pretrained( > "Salesforce/blip-image-captioning-base" > ) > self.processor = BlipProcessor.from_pretrained( > "Salesforce/blip-image-captioning-base" > ) > > def describe_image(self, image_path): > try: > # Open and process the image > image = Image.open(image_path) > inputs = self.processor(images=image, return_tensors="pt") > > # Generate description (caption) for the image > caption = self.model.generate(**inputs) > description = self.processor.decode(caption[0], skip_special_tokens=True) > return description > except Exception as e: > return f"Error processing image: {str(e)}" > > > # Define the entry point for the tool > def main(image_path): > tool = ImageDescriber() > description = tool.describe_image(image_path) > return {"description": description} > ``` > > ![Image](https://github.com/user-attachments/assets/f66ac0b8-656a-47ff-845c-4c93a91cb551) do you konw how to slove this problem?
Author
Owner

@Classic298 commented on GitHub (Mar 21, 2025):

@zhailianxing Just because it's on the community website doesn't mean it's working Code. There is also a lot of very outdated code there that no longer works.

Your code doesn't have a tool class and that's why it doesn't work

<!-- gh-comment-id:2742922125 --> @Classic298 commented on GitHub (Mar 21, 2025): @zhailianxing Just because it's on the community website doesn't mean it's working Code. There is also a lot of very outdated code there that no longer works. Your code doesn't have a tool class and that's why it doesn't work
Author
Owner

@zhailianxing commented on GitHub (Mar 23, 2025):

@zhailianxing Just because it's on the community website doesn't mean it's working Code. There is also a lot of very outdated code there that no longer works.

Your code doesn't have a tool class and that's why it doesn't work

Thanks, handsome man

<!-- gh-comment-id:2746186864 --> @zhailianxing commented on GitHub (Mar 23, 2025): > [@zhailianxing](https://github.com/zhailianxing) Just because it's on the community website doesn't mean it's working Code. There is also a lot of very outdated code there that no longer works. > > Your code doesn't have a tool class and that's why it doesn't work Thanks, handsome man
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#54379