Spaces:
Sleeping
Sleeping
Update OCR.py
Browse files
OCR.py
CHANGED
|
@@ -14,7 +14,7 @@ processor = AutoProcessor.from_pretrained(model_id)
|
|
| 14 |
|
| 15 |
def extract_text_from_image(image_content):
|
| 16 |
image = Image.open(io.BytesIO(image_content))
|
| 17 |
-
prompt =
|
| 18 |
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device)
|
| 19 |
input_len = inputs["input_ids"].shape[-1]
|
| 20 |
with torch.inference_mode():
|
|
|
|
| 14 |
|
| 15 |
def extract_text_from_image(image_content):
|
| 16 |
image = Image.open(io.BytesIO(image_content))
|
| 17 |
+
prompt = "Extract the following details from this invoice: Invoice Number, Amount, Invoice Date, Due Date."
|
| 18 |
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device)
|
| 19 |
input_len = inputs["input_ids"].shape[-1]
|
| 20 |
with torch.inference_mode():
|