lzy337 commited on
Commit
deddc60
·
verified ·
1 Parent(s): dfa7aa6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -6
README.md CHANGED
@@ -10,7 +10,7 @@ Below is the code of a quick demo:
10
 
11
  ```
12
  # pip install "transformers>=4.42" pillow openai
13
- # 并启动你的 vLLM 服务,例如:
14
  # vllm serve osunlp/GUI-Drag-7B --tensor-parallel-size 1 --dtype bfloat16 --port 8000
15
 
16
  import base64
@@ -23,7 +23,7 @@ from PIL import Image
23
  from transformers.models.qwen2_vl.image_processing_qwen2_vl_fast import smart_resize as qwen_smart_resize
24
 
25
  MODEL_NAME = "GUI-Drag-7B"
26
- BASE_URL = "http://localhost:8000/v1" # 替换成你的 vLLM 服务端口
27
  FN_CALL_TEMPLATE = """You are a helpful assistant.
28
  # Tools
29
  You may call one or more functions to assist with the user query.
@@ -61,17 +61,17 @@ def process_simple_drag_response(parsed_responses):
61
  def resize_back(coords, original_size, resized_size):
62
  ox, oy = original_size
63
  rx, ry = resized_size
64
- return round(coords[0] * ox / rx), round(coords[1] * oy / ry)
65
 
66
  def demo():
67
  image_path = Path("demo_image.png")
68
- instruction = "Drag to select the highlighted paragraph."
69
  image = Image.open(image_path)
70
 
71
  resized_h, resized_w = qwen_smart_resize(
72
  image.height, image.width,
73
- max_pixels=2_116_800,
74
- min_pixels=12_544,
75
  )
76
 
77
  messages = [
 
10
 
11
  ```
12
  # pip install "transformers>=4.42" pillow openai
13
+ # start vllm server like:
14
  # vllm serve osunlp/GUI-Drag-7B --tensor-parallel-size 1 --dtype bfloat16 --port 8000
15
 
16
  import base64
 
23
  from transformers.models.qwen2_vl.image_processing_qwen2_vl_fast import smart_resize as qwen_smart_resize
24
 
25
  MODEL_NAME = "GUI-Drag-7B"
26
+ BASE_URL = "http://localhost:8000/v1" # replace it with your own port
27
  FN_CALL_TEMPLATE = """You are a helpful assistant.
28
  # Tools
29
  You may call one or more functions to assist with the user query.
 
61
  def resize_back(coords, original_size, resized_size):
62
  ox, oy = original_size
63
  rx, ry = resized_size
64
+ return round(coords[0] * rx / ox), round(coords[1] * ry / oy)
65
 
66
  def demo():
67
  image_path = Path("demo_image.png")
68
+ instruction = "Drag to select the first sentence of the first paragraph."
69
  image = Image.open(image_path)
70
 
71
  resized_h, resized_w = qwen_smart_resize(
72
  image.height, image.width,
73
+ max_pixels=2116800,
74
+ min_pixels=12544,
75
  )
76
 
77
  messages = [