leonarb commited on
Commit
0f8f93a
·
verified ·
1 Parent(s): 1c69c6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -2,11 +2,13 @@ import gradio as gr
2
  import torch
3
  import pypdfium2
4
  from PIL import Image
5
- from transformers import Qwen2VLProcessor, Qwen2VLModel
6
 
7
  # Load model and processor
8
  model_name = "Qwen/Qwen-VL" # You may replace with your preferred VL model
9
- processor = Qwen2VLProcessor.from_pretrained(model_name)
 
 
10
  model = Qwen2VLModel.from_pretrained(
11
  model_name,
12
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
 
2
  import torch
3
  import pypdfium2
4
  from PIL import Image
5
+ from transformers import Qwen2VLProcessor, Qwen2VLImageProcessor, AutoTokenizer, Qwen2VLModel
6
 
7
  # Load model and processor
8
  model_name = "Qwen/Qwen-VL" # You may replace with your preferred VL model
9
+ image_processor = Qwen2VLImageProcessor.from_pretrained(model_name)
10
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
11
+ processor = Qwen2VLProcessor(image_processor=image_processor, tokenizer=tokenizer)
12
  model = Qwen2VLModel.from_pretrained(
13
  model_name,
14
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32