Skip to content

Instantly share code, notes, and snippets.

@tcapelle
Created October 15, 2024 15:39
Show Gist options
  • Save tcapelle/ee57e440ab25ff4002332d521d675678 to your computer and use it in GitHub Desktop.
Save tcapelle/ee57e440ab25ff4002332d521d675678 to your computer and use it in GitHub Desktop.
Simple script to call Llama 90b
import os, openai, weave
MODEL = "meta-llama/Llama-3.2-90B-Vision-Instruct"
weave.init("llama32_90B_EU")
image_url = "https://www.hachette.fr/sites/default/files/webmasters/l023-1.png"
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, prompt="What's on the image?"):
messages = [{
"role": "user",
"content": [{"type": "text","text": prompt},
{"type": "image_url","image_url": {"url": image}}]}]
response = llama_client.chat.completions.create(
messages=messages,
temperature=0.1,
model=MODEL)
return response.choices[0].message.content
print("="*100)
print(call_llama32(
image_url,
prompt="Extract every bubble from the Asterix novel in order"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment