🎉 Introduction to new functions of GPTCache
- 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)
- 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
}
)
- Support to flush data for preventing accidental loss of memory data
from gptcache import cache
cache.flush()
What's Changed
- Add image embedding timm by @jaelgu in #249
- Fix typo in release_note.md by @eltociear in #251
- Allow image path or file-like object as input of image embedding by @jaelgu in #252
- Fix docs by @junjiejiangjjj in #250
- Add replicate run adapter by @shiyu22 in #248
- Fix adapter with image object store by @jaelgu in #253
- Fix image mode issue by @jaelgu in #254
- Fix that 'NoneType' object has no attribute 'answers' by @SimFG in #256
- Update the bootcamp doc by @shiyu22 in #257
- Support to flush data for preventing accidental loss of memory data by @SimFG in #258
- Add evaluator for vqa by @jaelgu in #259
- Enable adapter.replicate docstring in API reference by @jaelgu in #260
- Update the version to
0.1.17
by @SimFG in #261
New Contributors
- @eltociear made their first contribution in #251
Full Changelog: 0.1.16...0.1.17