ydshieh HF staff commited on
Commit
d27a9f0
1 Parent(s): 89e84b3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +7 -0
README.md CHANGED
@@ -29,6 +29,13 @@ prompt = "<grounding>An image of"
29
  url = "https://huggingface.co/ydshieh/kosmos-2-patch14-224/resolve/main/snowman.jpg"
30
  image = Image.open(requests.get(url, stream=True).raw)
31
 
 
 
 
 
 
 
 
32
  inputs = processor(text=prompt, images=image, return_tensors="pt")
33
 
34
  generated_ids = model.generate(
 
29
  url = "https://huggingface.co/ydshieh/kosmos-2-patch14-224/resolve/main/snowman.jpg"
30
  image = Image.open(requests.get(url, stream=True).raw)
31
 
32
+ # The original Kosmos-2 demo saves the image first then reload it. For some images, this will give slightly different image input and change the generation outputs.
33
+ # Uncomment the following 2 lines if you want to match the original demo's outputs.
34
+ # (One example is the `two_dogs.jpg` from the demo)
35
+ # image.save("new_image.jpg")
36
+ # image = Image.open("new_image.jpg")
37
+
38
+
39
  inputs = processor(text=prompt, images=image, return_tensors="pt")
40
 
41
  generated_ids = model.generate(