Find answers from the community

Updated 3 months ago

LlamaIndex + Gemini

Hi Friends,
I am trying to use gemini by following this tutorial https://blog.llamaindex.ai/llamaindex-gemini-8d7c3b9ea97e

The code example shows that it takes some pictures from the internet by putting urls. Since I have my pictures in my local computer, does LlamaIndex have a function that can load image from local computer ?

Here is the code example in that tutorial :

from llama_index.multi_modal_llms.gemini import GeminiMultiModal
from llama_index.multi_modal_llms.generic_utils import (
load_image_urls,
)

image_urls = [
"",
# Add yours here!
]
image_documents = load_image_urls(image_urls)
gemini_pro = GeminiMultiModal(model="models/gemini-pro")
complete_response = gemini_pro.complete(
prompt="Identify the city where this photo was taken.",
image_documents=image_documents,
)
L
i
2 comments
Just use SimpleDirectoryReader and point it at your folder of images

image_documents = SimpleDirectoryReader("./folder_of_images").load_data()
Thanks a lot @Logan M
Add a reply
Sign up and join the conversation on Discord