wjm55 commited on
Commit
d312ec3
·
1 Parent(s): f07ac74

Update to Qwen2.5-VL model and clean up requirements

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. requirements.txt +1 -3
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import spaces
3
- from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
4
  from qwen_vl_utils import process_vision_info
5
  import torch
6
  from PIL import Image
@@ -49,15 +49,15 @@ def array_to_image_path(image_array):
49
  return full_path
50
 
51
  models = {
52
- "Qwen/Qwen2-VL-7B-Instruct": Qwen2VLForConditionalGeneration.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True, torch_dtype="auto").cuda().eval()
53
 
54
  }
55
 
56
  processors = {
57
- "Qwen/Qwen2-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True)
58
  }
59
 
60
- DESCRIPTION = "This demo uses[Qwen2-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct)"
61
 
62
  kwargs = {}
63
  kwargs['torch_dtype'] = torch.bfloat16
 
1
  import gradio as gr
2
  import spaces
3
+ from transformers import Qwen2VLForConditionalGeneration, AutoProcessor, Qwen2_5_VLForConditionalGeneration
4
  from qwen_vl_utils import process_vision_info
5
  import torch
6
  from PIL import Image
 
49
  return full_path
50
 
51
  models = {
52
+ "Qwen2.5-VL-7B-Instruct": Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen2.5-VL-7B-Instruct", trust_remote_code=True, torch_dtype="auto").cuda().eval()
53
 
54
  }
55
 
56
  processors = {
57
+ "Qwen2.5-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen2.5-VL-7B-Instruct", trust_remote_code=True)
58
  }
59
 
60
+ DESCRIPTION = "This demo uses[Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)"
61
 
62
  kwargs = {}
63
  kwargs['torch_dtype'] = torch.bfloat16
requirements.txt CHANGED
@@ -3,8 +3,6 @@ Pillow==10.3.0
3
  Requests==2.31.0
4
  torch
5
  torchvision
6
- git+https://github.com/huggingface/transformers.git
7
  accelerate
8
  qwen-vl-utils
9
- git+https://github.com/huggingface/transformers.git
10
- gliner
 
3
  Requests==2.31.0
4
  torch
5
  torchvision
6
+ git+https://github.com/huggingface/transformers
7
  accelerate
8
  qwen-vl-utils