leoxiaobin haipingwu commited on
Commit
9509157
1 Parent(s): 0c7be59

add_grounding_example (#3)

Browse files

- add grounding example (10934606d2fcd32b4359d2fdabbb4aa84052b1ef)


Co-authored-by: Haiping Wu <[email protected]>

Files changed (1) hide show
  1. README.md +4 -1
README.md CHANGED
@@ -85,7 +85,10 @@ processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_re
85
  url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
86
  image = Image.open(requests.get(url, stream=True).raw)
87
 
88
- def run_example(prompt):
 
 
 
89
 
90
  inputs = processor(text=prompt, images=image, return_tensors="pt")
91
  generated_ids = model.generate(
 
85
  url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
86
  image = Image.open(requests.get(url, stream=True).raw)
87
 
88
+ def run_example(prompt, text_input=None):
89
+
90
+ if text_input is not None:
91
+ prompt = prompt + text_input
92
 
93
  inputs = processor(text=prompt, images=image, return_tensors="pt")
94
  generated_ids = model.generate(