prithivMLmods commited on
Commit
1fc71d0
·
verified ·
1 Parent(s): 9be4fb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -71,7 +71,7 @@ def parse_page(image: Image.Image, model_name: str) -> str:
71
  else:
72
  raise ValueError(f"Unknown model choice: {model_name}")
73
 
74
- messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": "Perform OCR on the image precisely. Parse this document page into a clean, structured HTML representation. Preserve the logical structure with appropriate tags for content blocks such as paragraphs (<p>), headings (<h1>-<h6>), tables (<table>), figures (<figure>), formulas (<formula>), and others. Include category tags, and filter out irrelevant elements like headers and footers."}]}]
75
  prompt_full = current_processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
76
  inputs = current_processor(text=[prompt_full], images=[image], return_tensors="pt", padding=True).to(device)
77
 
 
71
  else:
72
  raise ValueError(f"Unknown model choice: {model_name}")
73
 
74
+ messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": "Parse this document page into a clean, structured HTML representation. Preserve the logical structure with appropriate tags for content blocks such as paragraphs (<p>), headings (<h1>-<h6>), tables (<table>), figures (<figure>), formulas (<formula>), and others. Include category tags, and filter out irrelevant elements like headers and footers."}]}]
75
  prompt_full = current_processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
76
  inputs = current_processor(text=[prompt_full], images=[image], return_tensors="pt", padding=True).to(device)
77