prithivMLmods commited on
Commit
a9a60a5
·
verified ·
1 Parent(s): e6ddca2

update app

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -133,6 +133,7 @@ MODEL_ID_V = "datalab-to/chandra"
133
  processor_v = AutoProcessor.from_pretrained(MODEL_ID_V, trust_remote_code=True)
134
  model_v = Qwen3VLForConditionalGeneration.from_pretrained(
135
  MODEL_ID_V,
 
136
  trust_remote_code=True,
137
  torch_dtype=torch.float16
138
  ).to(device).eval()
@@ -142,6 +143,7 @@ MODEL_ID_X = "nanonets/Nanonets-OCR2-3B"
142
  processor_x = AutoProcessor.from_pretrained(MODEL_ID_X, trust_remote_code=True)
143
  model_x = Qwen2_5_VLForConditionalGeneration.from_pretrained(
144
  MODEL_ID_X,
 
145
  trust_remote_code=True,
146
  torch_dtype=torch.bfloat16,
147
  ).to(device).eval()
@@ -162,6 +164,7 @@ MODEL_ID_M = "allenai/olmOCR-2-7B-1025"
162
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
163
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
164
  MODEL_ID_M,
 
165
  trust_remote_code=True,
166
  torch_dtype=torch.float16
167
  ).to(device).eval()
@@ -235,7 +238,7 @@ image_examples = [
235
  ["Extract the contents. [page].", "examples/2.jpg"],
236
  ]
237
 
238
- with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
239
  gr.Markdown("# **Multimodal [OCR3](https://huggingface.co/collections/prithivMLmods/multimodal-implementations)**", elem_id="main-title")
240
  with gr.Row():
241
  with gr.Column(scale=2):
@@ -274,4 +277,4 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
274
  )
275
 
276
  if __name__ == "__main__":
277
- demo.queue(max_size=50).launch(mcp_server=True, ssr_mode=False, show_error=True)
 
133
  processor_v = AutoProcessor.from_pretrained(MODEL_ID_V, trust_remote_code=True)
134
  model_v = Qwen3VLForConditionalGeneration.from_pretrained(
135
  MODEL_ID_V,
136
+ attn_implementation="flash_attention_2",
137
  trust_remote_code=True,
138
  torch_dtype=torch.float16
139
  ).to(device).eval()
 
143
  processor_x = AutoProcessor.from_pretrained(MODEL_ID_X, trust_remote_code=True)
144
  model_x = Qwen2_5_VLForConditionalGeneration.from_pretrained(
145
  MODEL_ID_X,
146
+ attn_implementation="flash_attention_2",
147
  trust_remote_code=True,
148
  torch_dtype=torch.bfloat16,
149
  ).to(device).eval()
 
164
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
165
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
166
  MODEL_ID_M,
167
+ attn_implementation="flash_attention_2",
168
  trust_remote_code=True,
169
  torch_dtype=torch.float16
170
  ).to(device).eval()
 
238
  ["Extract the contents. [page].", "examples/2.jpg"],
239
  ]
240
 
241
+ with gr.Blocks() as demo:
242
  gr.Markdown("# **Multimodal [OCR3](https://huggingface.co/collections/prithivMLmods/multimodal-implementations)**", elem_id="main-title")
243
  with gr.Row():
244
  with gr.Column(scale=2):
 
277
  )
278
 
279
  if __name__ == "__main__":
280
+ demo.queue(max_size=50).launch(css=css, theme=steel_blue_theme, mcp_server=True, ssr_mode=False, show_error=True)