Skip to main content

Computer-Use Interface (CUI) framework powering Cua

Project description

Shows my svg

Python macOS Discord PyPI

cua-computer is a Computer-Use Interface (CUI) framework powering Cua for interacting with local macOS and Linux sandboxes, PyAutoGUI-compatible, and pluggable with any AI agent systems (Cua, Langchain, CrewAI, AutoGen). Computer relies on Lume for creating and managing sandbox environments.

Get started with Computer

from computer import Computer

computer = Computer(os_type="macos", display="1024x768", memory="8GB", cpu="4")
try:
    await computer.run()
    
    screenshot = await computer.interface.screenshot()
    with open("screenshot.png", "wb") as f:
        f.write(screenshot)
    
    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)

    await computer.interface.type("Hello, World!")
    await computer.interface.press_key("enter")

    await computer.interface.set_clipboard("Test clipboard")
    content = await computer.interface.copy_to_clipboard()
    print(f"Clipboard content: {content}")
finally:
    await computer.stop()

Install

To install the Computer-Use Interface (CUI):

pip install "cua-computer[all]"

The cua-computer PyPi package pulls automatically the latest executable version of Lume through pylume.

Run

Refer to this notebook for a step-by-step guide on how to use the Computer-Use Interface (CUI):

Using the Gradio Computer UI

The computer module includes a Gradio UI for creating and sharing demonstration data. We make it easy for people to build community datasets for better computer use models with an upload to Huggingface feature.

# Install with UI support
pip install "cua-computer[ui]"

Note: For precise control of the computer, we recommend using VNC or Screen Sharing instead of the Computer Gradio UI.

Building and Sharing Demonstrations with Huggingface

Follow these steps to contribute your own demonstrations:

1. Set up Huggingface Access

Set your HF_TOKEN in a .env file or in your environment variables:

# In .env file
HF_TOKEN=your_huggingface_token

2. Launch the Computer UI

# launch_ui.py
from computer.ui.gradio.app import create_gradio_ui
from dotenv import load_dotenv
load_dotenv('.env')

app = create_gradio_ui()
app.launch(share=False)

For examples, see Computer UI Examples

3. Record Your Tasks

View demonstration video

Record yourself performing various computer tasks using the UI.

4. Save Your Demonstrations

View demonstration video

Save each task by picking a descriptive name and adding relevant tags (e.g., "office", "web-browsing", "coding").

5. Record Additional Demonstrations

Repeat steps 3 and 4 until you have a good amount of demonstrations covering different tasks and scenarios.

6. Upload to Huggingface

View demonstration video

Upload your dataset to Huggingface by:

  • Naming it as {your_username}/{dataset_name}
  • Choosing public or private visibility
  • Optionally selecting specific tags to upload only tasks with certain tags

Examples and Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cua_computer-0.4.4.tar.gz (75.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cua_computer-0.4.4-py3-none-any.whl (87.9 kB view details)

Uploaded Python 3

File details

Details for the file cua_computer-0.4.4.tar.gz.

File metadata

  • Download URL: cua_computer-0.4.4.tar.gz
  • Upload date:
  • Size: 75.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for cua_computer-0.4.4.tar.gz
Algorithm Hash digest
SHA256 6292a183f43dc78737dd5b3b9b65b4f3040b1b11d1e0a476282fb2f90777c690
MD5 0239fc8c216d0bb5f12175eacf812bfc
BLAKE2b-256 618e799fd9a85fb1519af531f2c1ccacac1c2dcb4007b61418bb25e6fba9b76f

See more details on using hashes here.

File details

Details for the file cua_computer-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: cua_computer-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 87.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for cua_computer-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a55afad2e8149abf9185fe3f35f4f1f5cb12d8da0e49c2d3fe4618adc3b3dfd
MD5 8f7ee7a2cf26d21e7fef7800f2c53bb7
BLAKE2b-256 4fa8e25b710b94ca71dc72a61da370d100b38858633ce541d0ff2f2e74b88a36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page