def create(cls, text): """Create a new memory with text and optionally base64 representation of the image content found at the URI in the text argument. Args: text (str): This is required for all memories. If this is a link to an image, a base64_image thumbnail will be generated for said image. """ created_memory = Memory(text=text) if uri_valid_image(text): # valid uri to image? created_memory.base64_image = glitch.glitch_from_url(text) return created_memory
def __init__(self, text): """Create a new memory with text and optionally base64 representation of the image content found at the URI in the text argument. Args: text (str): This is required for all memories. If this is a link to an image, a base64_image thumbnail will be generated for said image. """ self.text = text if uri_valid_image(text): # valid uri to image? self.base64_image = glitch.glitch_from_url(text) else: self.base64_image = None