Update README.md
Browse files
README.md
CHANGED
|
@@ -21,14 +21,14 @@ It achieves the following results on the evaluation set:
|
|
| 21 |
### Inference Code versions
|
| 22 |
|
| 23 |
# Code
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
prompt = task_prompt
|
| 34 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
|
|
|
| 21 |
### Inference Code versions
|
| 22 |
|
| 23 |
# Code
|
| 24 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 25 |
+
import matplotlib.pyplot as plt
|
| 26 |
+
import matplotlib.patches as patches
|
| 27 |
|
| 28 |
+
model = AutoModelForCausalLM.from_pretrained("Musa07/Florence-2-large-FormClassification-ft", trust_remote_code=True, device_map='cuda') # Load the model on GPU if available
|
| 29 |
+
processor = AutoProcessor.from_pretrained("Musa07/Florence-2-large-FormClassification-ft", trust_remote_code=True)
|
| 30 |
|
| 31 |
+
def run_example(task_prompt, image, max_new_tokens=128):
|
| 32 |
|
| 33 |
prompt = task_prompt
|
| 34 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|