Daemontatox commited on
Commit
2ebf628
·
verified ·
1 Parent(s): 2ba178a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from transformers import MllamaForConditionalGeneration, AutoProcessor, TextIteratorStreamer , AutoModel,Qwen2VLForConditionalGeneration, AutoModelForImageTextToText
2
  from qwen_vl_utils import process_vision_info
3
  from PIL import Image
4
  import requests
@@ -18,8 +18,8 @@ logging.basicConfig(level=logging.INFO)
18
  logger = logging.getLogger(__name__)
19
 
20
  # Load model and processor
21
- ckpt ="mistral-community/pixtral-12b"
22
- model = AutoModelForImageTextToText.from_pretrained(ckpt, torch_dtype=torch.bfloat16,trust_remote_code=True).to("cuda")
23
  processor = AutoProcessor.from_pretrained(ckpt,trust_remote_code=True)
24
 
25
  class DocumentState:
@@ -49,7 +49,7 @@ def process_pdf_file(file_path):
49
  if page_text.strip():
50
  text += f"Page {page_num + 1}:\n{page_text}\n\n"
51
 
52
- zoom = 2.5
53
  mat = fitz.Matrix(zoom, zoom)
54
  pix = page.get_pixmap(matrix=mat, alpha=False)
55
  img_data = pix.tobytes("png")
 
1
+ from transformers import MllamaForConditionalGeneration, AutoProcessor, TextIteratorStreamer , AutoModel,Qwen2VLForConditionalGeneration, AutoModelForImageTextToText , Qwen2_5_VLForConditionalGeneration
2
  from qwen_vl_utils import process_vision_info
3
  from PIL import Image
4
  import requests
 
18
  logger = logging.getLogger(__name__)
19
 
20
  # Load model and processor
21
+ ckpt ="Qwen/Qwen2.5-VL-7B-Instruct"
22
+ model = Qwen2_5_VLForConditionalGeneration.from_pretrained(ckpt, torch_dtype=torch.bfloat16,trust_remote_code=True).to("cuda")
23
  processor = AutoProcessor.from_pretrained(ckpt,trust_remote_code=True)
24
 
25
  class DocumentState:
 
49
  if page_text.strip():
50
  text += f"Page {page_num + 1}:\n{page_text}\n\n"
51
 
52
+ zoom = 3
53
  mat = fitz.Matrix(zoom, zoom)
54
  pix = page.get_pixmap(matrix=mat, alpha=False)
55
  img_data = pix.tobytes("png")