get image in tool #3342

Closed
opened 2025-11-11 15:29:39 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @heyfavour on GitHub (Jan 22, 2025).

how to get image in tools?
i try to get image_url but sometimes image_url will be wrong

import os
import requests
import base64
from datetime import datetime
from io import BytesIO


class Tools:
    def __init__(self):
        passs

    def get_SMILES(self, image_url: str) -> str:
        """
        Extract chemical SMILES from a Base64-encoded image.

        :param image_url: Base64-encoded image.
        :return: The SMILES string representing the chemical structure in the image.
        """
        try:
            image_url = image_url.split(",")[1]
            print(image_url)#sometimes image_url is wrong here 
  
        except Exception as e:
            return str(e)
Originally created by @heyfavour on GitHub (Jan 22, 2025). how to get image in tools? i try to get image_url but sometimes image_url will be wrong ``` import os import requests import base64 from datetime import datetime from io import BytesIO class Tools: def __init__(self): passs def get_SMILES(self, image_url: str) -> str: """ Extract chemical SMILES from a Base64-encoded image. :param image_url: Base64-encoded image. :return: The SMILES string representing the chemical structure in the image. """ try: image_url = image_url.split(",")[1] print(image_url)#sometimes image_url is wrong here except Exception as e: return str(e) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3342