Update README.md
Browse files
README.md
CHANGED
@@ -47,8 +47,8 @@ model = AutoModelForCausalLM.from_pretrained("thwri/CogFlorence-2-Large-Freeze",
|
|
47 |
processor = AutoProcessor.from_pretrained("thwri/CogFlorence-2-Large-Freeze", trust_remote_code=True)
|
48 |
|
49 |
# Function to run the model on an example
|
50 |
-
def run_example(task_prompt,
|
51 |
-
prompt = task_prompt
|
52 |
|
53 |
# Ensure the image is in RGB mode
|
54 |
if image.mode != "RGB":
|
@@ -72,7 +72,8 @@ import copy
|
|
72 |
|
73 |
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
|
74 |
image = Image.open(requests.get(url, stream=True).raw)
|
75 |
-
run_example("<MORE_DETAILED_CAPTION>"
|
|
|
76 |
|
77 |
# {'<MORE_DETAILED_CAPTION>': 'a turquoise volkswagen beetle parked on a cobblestone street in front of a yellow wall with two wooden doors. the car's body is painted in a vibrant shade of teal, with a glossy finish that reflects the sunlight, and the wheels are polished with a silver hubcap. the building behind the car has a weathered, aged appearance, with visible cracks and peeling paint. the sky above is clear and blue, suggesting a sunny day.'}
|
78 |
```
|
|
|
47 |
processor = AutoProcessor.from_pretrained("thwri/CogFlorence-2-Large-Freeze", trust_remote_code=True)
|
48 |
|
49 |
# Function to run the model on an example
|
50 |
+
def run_example(task_prompt, image):
|
51 |
+
prompt = task_prompt
|
52 |
|
53 |
# Ensure the image is in RGB mode
|
54 |
if image.mode != "RGB":
|
|
|
72 |
|
73 |
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
|
74 |
image = Image.open(requests.get(url, stream=True).raw)
|
75 |
+
result = run_example("<MORE_DETAILED_CAPTION>" , image)
|
76 |
+
print(result)
|
77 |
|
78 |
# {'<MORE_DETAILED_CAPTION>': 'a turquoise volkswagen beetle parked on a cobblestone street in front of a yellow wall with two wooden doors. the car's body is painted in a vibrant shade of teal, with a glossy finish that reflects the sunlight, and the wheels are polished with a silver hubcap. the building behind the car has a weathered, aged appearance, with visible cracks and peeling paint. the sky above is clear and blue, suggesting a sunny day.'}
|
79 |
```
|