Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

restore examples

Dillon DuPontc90ca1ca68ca
diff --git a/examples/computer_examples.py b/examples/computer_examples.py
index 86a7deb0e2..7b9a1d4d2f 100644
--- a/examples/computer_examples.py
+++ b/examples/computer_examples.py
@@ -62,8 +62,8 @@ async def main():
# res = await computer.interface.run_command("touch ./Downloads/empty_file")
# print(f"Run command result: {res}")
- # accessibility_tree = await computer.interface.get_accessibility_tree()
- # print(f"Accessibility tree: {accessibility_tree}")
+ accessibility_tree = await computer.interface.get_accessibility_tree()
+ print(f"Accessibility tree: {accessibility_tree}")
# Screen Actions Examples
# print("\n=== Screen Actions ===")
@@ -71,36 +71,36 @@ async def main():
# with open("screenshot_direct.png", "wb") as f:
# f.write(screenshot)
- # screen_size = await computer.interface.get_screen_size()
- # print(f"Screen size: {screen_size}")
+ screen_size = await computer.interface.get_screen_size()
+ print(f"Screen size: {screen_size}")
# Demonstrate coordinate conversion
- # center_x, center_y = 733, 736
- # print(f"Center in screen coordinates: ({center_x}, {center_y})")
+ center_x, center_y = 733, 736
+ print(f"Center in screen coordinates: ({center_x}, {center_y})")
- # screenshot_center = await computer.to_screenshot_coordinates(center_x, center_y)
- # print(f"Center in screenshot coordinates: {screenshot_center}")
+ screenshot_center = await computer.to_screenshot_coordinates(center_x, center_y)
+ print(f"Center in screenshot coordinates: {screenshot_center}")
- # screen_center = await computer.to_screen_coordinates(*screenshot_center)
- # print(f"Back to screen coordinates: {screen_center}")
+ screen_center = await computer.to_screen_coordinates(*screenshot_center)
+ print(f"Back to screen coordinates: {screen_center}")
# Mouse Actions Examples
- # print("\n=== Mouse Actions ===")
- # await computer.interface.move_cursor(100, 100)
- # await computer.interface.left_click()
- # await computer.interface.right_click(300, 300)
- # await computer.interface.double_click(400, 400)
-
- # # Keyboard Actions Examples
- # print("\n=== Keyboard Actions ===")
- # await computer.interface.type_text("Hello, World!")
- # await computer.interface.press_key("enter")
-
- # # Clipboard Actions Examples
- # print("\n=== Clipboard Actions ===")
- # await computer.interface.set_clipboard("Test clipboard")
- # content = await computer.interface.copy_to_clipboard()
- # print(f"Clipboard content: {content}")
+ print("\n=== Mouse Actions ===")
+ await computer.interface.move_cursor(100, 100)
+ await computer.interface.left_click()
+ await computer.interface.right_click(300, 300)
+ await computer.interface.double_click(400, 400)
+
+ # Keyboard Actions Examples
+ print("\n=== Keyboard Actions ===")
+ await computer.interface.type_text("Hello, World!")
+ await computer.interface.press_key("enter")
+
+ # Clipboard Actions Examples
+ print("\n=== Clipboard Actions ===")
+ await computer.interface.set_clipboard("Test clipboard")
+ content = await computer.interface.copy_to_clipboard()
+ print(f"Clipboard content: {content}")
finally:
# Important to clean up resources