Skip to content

Instantly share code, notes, and snippets.

@tcapelle
Last active September 27, 2024 17:00
Show Gist options
  • Save tcapelle/2dcf77db45fa6e6e77767c8244d1f150 to your computer and use it in GitHub Desktop.
Save tcapelle/2dcf77db45fa6e6e77767c8244d1f150 to your computer and use it in GitHub Desktop.
import os, openai, weave
MODEL = "Llama-3.2-90B-Vision-Instruct"
weave.init("EU_HAS_LLAMA_90B")
image_url = "https://limaspanishhouse.com/wp-content/uploads/2021/02/peruvian-llama-2-1536x1346.jpg"
llama_client = openai.OpenAI(
base_url="http://195.242.25.198:8032/v1",
api_key=os.environ.get("WANDB_API_KEY")
)
@weave.op
def call_llama32(image_url, prompt="What's on the image?"):
messages = [{
"role": "user",
"content": [{"type": "text","text": prompt},
{"type": "image_url","image_url": {"url": image_url}}]}]
response = llama_client.chat.completions.create(
messages=messages,
model=MODEL)
return response.choices[0].message.content
print("="*100)
print(call_llama32(image_url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment