File size: 839 Bytes
3e22cd7
 
947a25f
 
 
 
3e22cd7
947a25f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3e22cd7
947a25f
3e22cd7
 
947a25f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="together",
    api_key="tgp_v1_zZbqhs_6F4dqyaOuTsivmragw0xi5FkT-71vv7YgAIE",
)

completion = client.chat.completions.create(
    model="meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe this image in one sentence."
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
                    }
                }
            ]
        }
    ],
    max_tokens=512,
)

print(completion.choices[0].message)