github zilliztech/GPTCache 0.1.17
v0.1.17

latest releases: 0.1.44, 0.1.43, 0.1.42...
17 months ago

🎉 Introduction to new functions of GPTCache

  1. Add image embedding timm
import requests
from PIL import Image
from gptcache.embedding import Timm

url = 'https://raw.githubusercontent.com/zilliztech/GPTCache/main/docs/GPTCache.png'
image = Image.open(requests.get(url, stream=True).raw)  # Read image url as PIL.Image      
encoder = Timm(model='resnet18')
image_tensor = encoder.preprocess(image)
embed = encoder.to_embeddings(image_tensor)
  1. Add Replicate adapter, vqa (visual question answering) (experimental)
from gptcache.adapter import replicate

question = "what is in the image?"

replicate.run(
    "andreasjansson/blip-2:xxx",
    input={
        "image": open(image_path, 'rb'),
        "question": question
    }
)
  1. Support to flush data for preventing accidental loss of memory data
from gptcache import cache

cache.flush()

What's Changed

New Contributors

Full Changelog: 0.1.16...0.1.17

Don't miss a new GPTCache release

NewReleases is sending notifications on new releases.