nielsr HF Staff commited on
Commit
b347340
·
verified ·
1 Parent(s): dc34666

Add metadata and paper link to model card

Browse files

Hi! I'm Niels, part of the community science team at Hugging Face.

This PR improves the model card for GUI-Drag-7B:
- Adds metadata for `pipeline_tag` and `library_name`.
- Links the model repository to the associated research paper: [Beyond Clicking: A Step Towards Generalist GUI Grounding via Text Dragging](https://huggingface.co/papers/2601.06031).
- Includes links to the project page and GitHub repository for better visibility.
- Maintains the existing demo code while ensuring the literal new line characters (`\n`) in strings are preserved.

Files changed (1) hide show
  1. README.md +47 -21
README.md CHANGED
@@ -1,29 +1,34 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
3
  ---
4
 
5
- Our models are trained based on [Jedi models](https://huggingface.co/xlangai/Jedi-3B-1080p) via an efficient continual training strategy, which enhances the models' text dragging performance while perserving their original click-based performance.
6
 
7
- For details of how to employ the models, please refer to our [repo](https://github.com/OSU-NLP-Group/GUI-Drag/blob/48a3480fe580e93fb747f0eb8ae549d5eb18f57b/evaluation/cli_run_drag.sh#L14) examples.
8
 
9
- Project page: https://osu-nlp-group.github.io/GUI-Drag
10
 
11
- Below is the code of a quick demo (demo.png can be found at [here](https://github.com/OSU-NLP-Group/GUI-Drag/blob/main/demo.png)):
12
 
13
- ```
14
- # pip install openai pillow transformers
15
- # start the vllm server:
16
 
17
- '''
18
  vllm serve osunlp/GUI-Drag-7B \
19
  --host 0.0.0.0 \
20
  --port 8000 \
21
  --max-model-len 16384 \
22
  --tensor-parallel-size 2
23
- '''
24
-
25
-
26
 
 
 
27
  import base64
28
  import json
29
  import re
@@ -33,18 +38,32 @@ from openai import OpenAI
33
  from PIL import Image, ImageDraw
34
  from transformers.models.qwen2_vl.image_processing_qwen2_vl_fast import smart_resize as qwen_smart_resize
35
 
36
-
37
-
38
  MODEL_ID = "osunlp/GUI-Drag-7B"
39
  BASE_URL = "http://localhost:8000/v1"
40
 
41
-
42
  FN_CALL_TEMPLATE = """You are a helpful assistant.
43
  # Tools
44
  You may call one or more functions to assist with the user query.
45
  You are provided with function signatures within <tools></tools> XML tags:
46
  <tools>
47
- {{"type": "function", "function": {{"name": "computer_use", "description": "Use a mouse and keyboard to interact with a computer, and take screenshots.\n* This is an interface to a desktop GUI. You do not have access to a terminal or applications menu. You must click on desktop icons to start applications.\n* Some applications may take time to start or process actions, so you may need to wait and take successive screenshots to see the results of your actions. E.g. if you click on Firefox and a window doesn't open, try wait and taking another screenshot.\n* The screen's resolution is {width}x{height}.\n* Whenever you intend to move the cursor to click on an element like an icon, you should consult a screenshot to determine the coordinates of the element before moving the cursor.\n* If you tried clicking on a program or link but it failed to load, even after waiting, try adjusting your cursor position so that the tip of the cursor visually falls on the element that you want to click.\n* Make sure to click any buttons, links, icons, etc with the cursor tip in the center of the element. Don't click boxes on their edges unless asked.", "parameters": {{"properties": {{"action": {{"description": "The action to perform. The available actions are:\n* `key`: Performs key down presses on the arguments passed in order, then performs key releases in reverse order.\n* `type`: Type a string of text on the keyboard.\n* `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.\n* `left_click`: Click the left mouse button.\n* `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.\n* `right_click`: Click the right mouse button.\n* `middle_click`: Click the middle mouse button.\n* `double_click`: Double-click the left mouse button.\n* `scroll`: Performs a scroll of the mouse scroll wheel.\n* `wait`: Wait specified seconds for the change to happen.\n* `terminate`: Terminate the current task and report its completion status.", "enum": ["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "scroll", "wait", "terminate"], "type": "string"}}, "keys": {{"description": "Required only by `action=key`.", "type": "array"}}, "text": {{"description": "Required only by `action=type`.", "type": "string"}}, "coordinate": {{"description": "(x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move`, `action=left_click_drag`, `action=left_click`, `action=right_click`, `action=double_click`.", "type": "array"}}, "pixels": {{"description": "The amount of scrolling to perform. Positive values scroll up, negative values scroll down. Required only by `action=scroll`.", "type": "number"}}, "time": {{"description": "The seconds to wait. Required only by `action=wait`.", "type": "number"}}, "status": {{"description": "The status of the task. Required only by `action=terminate`.", "type": "string", "enum": ["success", "failure"]}}}}, "required": ["action"], "type": "object"}}}}}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  </tools>
49
  For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
50
  <tool_call>
@@ -52,13 +71,9 @@ For each function call, return a json object with function name and arguments wi
52
  </tool_call>
53
  """
54
 
55
-
56
-
57
  IMAGE_PATH = Path("demo.png")
58
  INSTRUCTION = "Drag to select the last sentence."
59
 
60
-
61
-
62
  def encode_image(image: Image) -> str:
63
  """Encode PIL image to base64 string"""
64
  output_buffer = io.BytesIO()
@@ -67,8 +82,6 @@ def encode_image(image: Image) -> str:
67
  base64_str = base64.b64encode(byte_data).decode("utf-8")
68
  return base64_str
69
 
70
-
71
-
72
  def resize_coordinates(coord, size_pred, size_to_be_mapped):
73
  return (
74
  round(coord[0] * size_to_be_mapped[0] / size_pred[0]),
@@ -140,4 +153,17 @@ def main():
140
 
141
  if __name__ == "__main__":
142
  main()
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  ```
 
1
  ---
2
  license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: image-text-to-text
5
+ tags:
6
+ - gui-grounding
7
+ - text-dragging
8
+ - vision-language
9
+ - qwen2.5-vl
10
  ---
11
 
12
+ # Beyond Clicking: A Step Towards Generalist GUI Grounding via Text Dragging
13
 
14
+ [**Project Page**](https://osu-nlp-group.github.io/GUI-Drag) | [**GitHub Repository**](https://github.com/OSU-NLP-Group/GUI-Drag) | [**Paper**](https://huggingface.co/papers/2601.06031)
15
 
16
+ GUI-Drag-7B is a multimodal model designed for GUI grounding, with a specific focus on text dragging interactions. While traditional models focus on clicking, GUI-Drag enables autonomous agents to select and manipulate textual content through dragging actions. The model is trained based on [Jedi models](https://huggingface.co/xlangai/Jedi-3B-1080p) via an efficient continual training strategy, which enhances text dragging performance while preserving original click-based capabilities.
17
 
18
+ ## Quick Demo
19
 
20
+ Below is the code of a quick demo (demo.png can be found at [here](https://github.com/OSU-NLP-Group/GUI-Drag/blob/main/demo.png)). To use the model, you can start a [vLLM](https://github.com/vllm-project/vllm) server:
 
 
21
 
22
+ ```bash
23
  vllm serve osunlp/GUI-Drag-7B \
24
  --host 0.0.0.0 \
25
  --port 8000 \
26
  --max-model-len 16384 \
27
  --tensor-parallel-size 2
28
+ ```
 
 
29
 
30
+ ```python
31
+ # pip install openai pillow transformers
32
  import base64
33
  import json
34
  import re
 
38
  from PIL import Image, ImageDraw
39
  from transformers.models.qwen2_vl.image_processing_qwen2_vl_fast import smart_resize as qwen_smart_resize
40
 
 
 
41
  MODEL_ID = "osunlp/GUI-Drag-7B"
42
  BASE_URL = "http://localhost:8000/v1"
43
 
 
44
  FN_CALL_TEMPLATE = """You are a helpful assistant.
45
  # Tools
46
  You may call one or more functions to assist with the user query.
47
  You are provided with function signatures within <tools></tools> XML tags:
48
  <tools>
49
+ {{"type": "function", "function": {{"name": "computer_use", "description": "Use a mouse and keyboard to interact with a computer, and take screenshots.
50
+ * This is an interface to a desktop GUI. You do not have access to a terminal or applications menu. You must click on desktop icons to start applications.
51
+ * Some applications may take time to start or process actions, so you may need to wait and take successive screenshots to see the results of your actions. E.g. if you click on Firefox and a window doesn't open, try wait and taking another screenshot.
52
+ * The screen's resolution is {width}x{height}.
53
+ * Whenever you intend to move the cursor to click on an element like an icon, you should consult a screenshot to determine the coordinates of the element before moving the cursor.
54
+ * If you tried clicking on a program or link but it failed to load, even after waiting, try adjusting your cursor position so that the tip of the cursor visually falls on the element that you want to click.
55
+ * Make sure to click any buttons, links, icons, etc with the cursor tip in the center of the element. Don't click boxes on their edges unless asked.", "parameters": {{"properties": {{"action": {{"description": "The action to perform. The available actions are:
56
+ * `key`: Performs key down presses on the arguments passed in order, then performs key releases in reverse order.
57
+ * `type`: Type a string of text on the keyboard.
58
+ * `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
59
+ * `left_click`: Click the left mouse button.
60
+ * `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
61
+ * `right_click`: Click the right mouse button.
62
+ * `middle_click`: Click the middle mouse button.
63
+ * `double_click`: Double-click the left mouse button.
64
+ * `scroll`: Performs a scroll of the mouse scroll wheel.
65
+ * `wait`: Wait specified seconds for the change to happen.
66
+ * `terminate`: Terminate the current task and report its completion status.", "enum": ["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "scroll", "wait", "terminate"], "type": "string"}}, "keys": {{"description": "Required only by `action=key`.", "type": "array"}}, "text": {{"description": "Required only by `action=type`.", "type": "string"}}, "coordinate": {{"description": "(x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move`, `action=left_click_drag`, `action=left_click`, `action=right_click`, `action=double_click`.", "type": "array"}}, "pixels": {{"description": "The amount of scrolling to perform. Positive values scroll up, negative values scroll down. Required only by `action=scroll`.", "type": "number"}}, "time": {{"description": "The seconds to wait. Required only by `action=wait`.", "type": "number"}}, "status": {{"description": "The status of the task. Required only by `action=terminate`.", "type": "string", "enum": ["success", "failure"]}}}}, "required": ["action"], "type": "object"}}}}}}
67
  </tools>
68
  For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
69
  <tool_call>
 
71
  </tool_call>
72
  """
73
 
 
 
74
  IMAGE_PATH = Path("demo.png")
75
  INSTRUCTION = "Drag to select the last sentence."
76
 
 
 
77
  def encode_image(image: Image) -> str:
78
  """Encode PIL image to base64 string"""
79
  output_buffer = io.BytesIO()
 
82
  base64_str = base64.b64encode(byte_data).decode("utf-8")
83
  return base64_str
84
 
 
 
85
  def resize_coordinates(coord, size_pred, size_to_be_mapped):
86
  return (
87
  round(coord[0] * size_to_be_mapped[0] / size_pred[0]),
 
153
 
154
  if __name__ == "__main__":
155
  main()
156
+ ```
157
+
158
+ ## Citation
159
+
160
+ If you find this work useful, please consider citing:
161
+
162
+ ```bibtex
163
+ @article{cheng2025beyond,
164
+ title={Beyond Clicking: A Step Towards Generalist GUI Grounding via Text Dragging},
165
+ author={Cheng, Kanzhi and Wu, Zhiyong and Wu, Zhenyu and Sun, Qiushi and Liang, Paul Pu and Qiao, Yu and Zhang, Ming and Luo, Xiao and others},
166
+ journal={arXiv preprint arXiv:2601.06031},
167
+ year={2025}
168
+ }
169
  ```