ydshieh HF staff commited on
Commit
6441180
1 Parent(s): 8266f46

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -1
README.md CHANGED
@@ -9,6 +9,8 @@
9
  Use the code below to get started with the model.
10
 
11
  ```python
 
 
12
  from PIL import Image
13
  from transformers import AutoProcessor, AutoModelForVision2Seq
14
 
@@ -17,7 +19,9 @@ model = AutoModelForVision2Seq.from_pretrained("ydshieh/kosmos-2-patch14-224", t
17
  processor = AutoProcessor.from_pretrained("ydshieh/kosmos-2-patch14-224", trust_remote_code=True)
18
 
19
  prompt = "<grounding>An image of"
20
- image = Image.open("snowman.jpg")
 
 
21
 
22
  inputs = processor(text=prompt, images=image, return_tensors="pt")
23
 
 
9
  Use the code below to get started with the model.
10
 
11
  ```python
12
+ import requests
13
+
14
  from PIL import Image
15
  from transformers import AutoProcessor, AutoModelForVision2Seq
16
 
 
19
  processor = AutoProcessor.from_pretrained("ydshieh/kosmos-2-patch14-224", trust_remote_code=True)
20
 
21
  prompt = "<grounding>An image of"
22
+
23
+ url = "https://huggingface.co/ydshieh/kosmos-2-patch14-224/resolve/main/snowman.jpg"
24
+ image = Image.open(requests.get(url, stream=True).raw)
25
 
26
  inputs = processor(text=prompt, images=image, return_tensors="pt")
27