Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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": "
|
| 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 |
|