mvalssj commited on
Commit
34bd644
1 Parent(s): 4e577f9
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import InferenceClient
2
+
3
+ client = InferenceClient(api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
4
+
5
+ image_url = "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
6
+
7
+ for message in client.chat_completion(
8
+ model="meta-llama/Llama-3.2-11B-Vision-Instruct",
9
+ messages=[
10
+ {
11
+ "role": "user",
12
+ "content": [
13
+ {"type": "image_url", "image_url": {"url": image_url}},
14
+ {"type": "text", "text": "Describe this image in one sentence."},
15
+ ],
16
+ }
17
+ ],
18
+ max_tokens=500,
19
+ stream=True,
20
+ ):
21
+ print(message.choices[0].delta.content, end="")