Spaces:
Running
Running
Update ocr_llm_utils.py
Browse files- ocr_llm_utils.py +2 -2
ocr_llm_utils.py
CHANGED
|
@@ -28,7 +28,7 @@ def run_ocr_with_gcv(image_path):
|
|
| 28 |
response = client_vision.document_text_detection(image=image)
|
| 29 |
return response.full_text_annotation.text
|
| 30 |
|
| 31 |
-
def extract_table_from_text(text,max_tokens=4096):
|
| 32 |
prompt = f"""
|
| 33 |
Extract a structured table of items from the invoice text below.
|
| 34 |
- First findout what are the table column names
|
|
@@ -44,7 +44,7 @@ def extract_table_from_text(text,max_tokens=4096):
|
|
| 44 |
\"\"\"
|
| 45 |
"""
|
| 46 |
response = client.chat.completions.create(
|
| 47 |
-
model=
|
| 48 |
messages=[
|
| 49 |
{"role": "system", "content": "You are a professional invoice data extractor."},
|
| 50 |
{"role": "user", "content": prompt}
|
|
|
|
| 28 |
response = client_vision.document_text_detection(image=image)
|
| 29 |
return response.full_text_annotation.text
|
| 30 |
|
| 31 |
+
def extract_table_from_text(text,max_tokens=4096,model="meta-llama/llama-4-scout-17b-16e-instruct"):
|
| 32 |
prompt = f"""
|
| 33 |
Extract a structured table of items from the invoice text below.
|
| 34 |
- First findout what are the table column names
|
|
|
|
| 44 |
\"\"\"
|
| 45 |
"""
|
| 46 |
response = client.chat.completions.create(
|
| 47 |
+
model=model,
|
| 48 |
messages=[
|
| 49 |
{"role": "system", "content": "You are a professional invoice data extractor."},
|
| 50 |
{"role": "user", "content": prompt}
|