Skip to main content

A library for automating computer interactions

Project description

Computer-interact

Recently, OpenAI released an operator agent that can browse the web and perform actions based on prompts. I attempted to build a basic computer-use capability for learning purposes. My approach differs from these agents and browser-use libraries because it has the potential to automate various computer tasks. Claude's computer use approach and ByteDance's UI-TARS are more advanced versions compared to my attempt. As part of this project, I built a basic library that performs minimal computer tasks.

Disclaimer: It is important to note that this is a starting point and requires further development to handle more complex scenarios.

A specific use case I envision is web search. For example, if we need to perform a web search on a specific topic, we often use Selenium or Playwright for web scraping. However, we frequently get blocked, especially by Google sites. If we can search the way a human does, these sites may not detect scraping.

Disclaimer: Currently, the library can navigate sites based on instructions, but data scraping is not yet implemented. Design

Architecture of the library

alt text

At the heart of this library lies the Qwen 2.5 VL 7B Instruct model. This powerful, 7-billion-parameter vision-language model can understand both image and text content. It goes beyond simple object detection by analyzing the structure and content of images, including text, charts, and layouts. This capability makes it well-suited for automating computer tasks, where understanding the visual context of a screen or interface is crucial.

Requirement

This required an Nvidia GPU with 12GB of VRAM to run the Hugging Face model locally. It also required the Gemini API.

Installation

  1. Setup conda enviornment with python 3.12

  2. Computer-interact and other software installation

    conda config --add channels pytorch
    conda config --add channels conda-forge
    conda config --add channels nvidia
    
    python -m pip install --upgrade computer-interact
    python -m pip install git+https://github.com/huggingface/transformers@f3f6c86582611976e72be054675e2bf0abb5f775
    
    
    
  3. Environment Setup

    This guide explains how to set up and manage environment variables for your project using python-dotenv.

    a. Install the python-dotenv library using pip:

    pip install python-dotenv
    

    b. Create a .env file in your project's root directory with the following structure:

    GEMINI_API_KEY=your_openai_api_key
    

    c. Add .env to your .gitignore file to prevent accidentally committing sensitive information:

    d. code for load environment variables

    from dotenv import load_dotenv
    import os
    load_dotenv()
    

How to change the basic config

  1. print config
print(supervisor.config)

#Typical output
{'debug': False, 'step_creation_model': 'gemini-2.0-pro-exp-02-05', 'computer_use_model': 'Qwen/Qwen2.5-VL-7B-Instruct'}
  1. modify
supervisor.config["debug"] = True
print(supervisor.config)

#Typical output
{'debug': False, 'step_creation_model': 'gemini-2.0-pro-exp-02-05', 'computer_use_model': 'Qwen/Qwen2.5-VL-7B-Instruct'}

Example

from computer_interact.supervisor import Supervisor
from dotenv import load_dotenv

load_dotenv()  

query = """
action 1: open the firfox web browser
action 2: click on the address bar
action 3: type scholar.google.com 
action 4: press enter for search
action 5: type openai in the search box of google scholar
action 6: press enter for search
action 7: close the browser
"""
user_query = query

supervisor = Supervisor()

supervisor.config["debug"] = True

# Make sure the config is changed before the configure function call.
supervisor.configure()
supervisor.run(user_query)

Medium article

Here is the link for the medium article regarding the library: https://medium.com/intro-to-artificial-intelligence/my-attempt-to-build-a-computer-use-capability-using-an-llm-35441b61e535

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

computer_interact-1.0.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

computer_interact-1.0.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file computer_interact-1.0.0.tar.gz.

File metadata

  • Download URL: computer_interact-1.0.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for computer_interact-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ddbe41a34d1fb0da0fa3d582cd05c2024badb5ba89a534cfc258592333aaee49
MD5 6a0f2c2e4842f36b0beafcd70b6fb5c7
BLAKE2b-256 55169a0540d5fb235a9d616da25b41956dda66356f2b89b091968a53826efb1c

See more details on using hashes here.

File details

Details for the file computer_interact-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for computer_interact-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 baff9bce0d5e974c383d19dfb74cdfe549e86a1c0b1dc93aba0ab41e9ef3a483
MD5 3603aa78efe23db752394287a705cc7d
BLAKE2b-256 5ec89c87f8a67af7f56fd369b035f5c25d8e51afb5fa6c30bcfb10620889afe7

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