Spaces:
Sleeping
Sleeping
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):
|
| 32 |
prompt = f"""
|
| 33 |
Extract a structured table of items from the invoice text below.
|
| 34 |
- First findout what are the table column names
|
|
@@ -50,7 +50,7 @@ def extract_table_from_text(text):
|
|
| 50 |
{"role": "user", "content": prompt}
|
| 51 |
],
|
| 52 |
temperature=1,
|
| 53 |
-
max_completion_tokens=
|
| 54 |
top_p=1,
|
| 55 |
)
|
| 56 |
return response.choices[0].message.content
|
|
|
|
| 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
|
|
|
|
| 50 |
{"role": "user", "content": prompt}
|
| 51 |
],
|
| 52 |
temperature=1,
|
| 53 |
+
max_completion_tokens=max_tokens,
|
| 54 |
top_p=1,
|
| 55 |
)
|
| 56 |
return response.choices[0].message.content
|