From 1718e57bd359d278d0860d379970adca0e443f15 Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Thu, 14 Aug 2025 10:15:00 -0400 Subject: [PATCH] Fixed incorrect port, added docker provider to gradio UI --- .../agent/agent/ui/gradio/ui_components.py | 29 +++++++++++++------ libs/python/computer/computer/computer.py | 10 +++++-- .../computer/providers/docker/provider.py | 8 ++--- .../computer/computer/providers/factory.py | 2 +- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/libs/python/agent/agent/ui/gradio/ui_components.py b/libs/python/agent/agent/ui/gradio/ui_components.py index c601fb6c..bc6978f7 100644 --- a/libs/python/agent/agent/ui/gradio/ui_components.py +++ b/libs/python/agent/agent/ui/gradio/ui_components.py @@ -187,7 +187,7 @@ if __name__ == "__main__": """
CUA Logo + src="https://github.com/trycua/cua/blob/main/img/logo_white.png?raw=true" />
""" ) @@ -201,22 +201,33 @@ if __name__ == "__main__": ) with gr.Accordion("Computer Configuration", open=True): - computer_os = gr.Radio( - choices=["macos", "linux", "windows"], - label="Operating System", - value="macos", - info="Select the operating system for the computer", - ) - is_windows = platform.system().lower() == "windows" is_mac = platform.system().lower() == "darwin" - providers = ["cloud", "localhost"] + providers = ["cloud", "localhost", "docker"] if is_mac: providers += ["lume"] if is_windows: providers += ["winsandbox"] + # Remove unavailable options + # MacOS is unavailable if Lume is not available + # Windows is unavailable if Winsandbox is not available + # Linux is always available + # This should be removed once we support macOS and Windows on the cloud provider + computer_choices = ["macos", "linux", "windows"] + if not is_mac or "lume" not in providers: + computer_choices.remove("macos") + if not is_windows or "winsandbox" not in providers: + computer_choices.remove("windows") + + computer_os = gr.Radio( + choices=computer_choices, + label="Operating System", + value=computer_choices[0], + info="Select the operating system for the computer", + ) + computer_provider = gr.Radio( choices=providers, label="Provider", diff --git a/libs/python/computer/computer/computer.py b/libs/python/computer/computer/computer.py index 644aaa31..59b074c8 100644 --- a/libs/python/computer/computer/computer.py +++ b/libs/python/computer/computer/computer.py @@ -43,7 +43,7 @@ class Computer: cpu: str = "4", os_type: OSType = "macos", name: str = "", - image: str = "macos-sequoia-cua:latest", + image: Optional[str] = None, shared_directories: Optional[List[str]] = None, use_host_computer_server: bool = False, verbosity: Union[int, LogLevel] = logging.INFO, @@ -88,6 +88,12 @@ class Computer: self.logger = Logger("computer", verbosity) self.logger.info("Initializing Computer...") + if os_type == "macos": + image = "macos-sequoia-cua:latest" + elif os_type == "linux": + image = "trycua/cua-ubuntu:latest" + image = str(image) + # Store original parameters self.image = image self.port = port @@ -310,7 +316,7 @@ class Computer: host=host, storage=storage, shared_path=shared_path, - image=image or "cua-ubuntu:latest", + image=image or "trycua/cua-ubuntu:latest", verbose=verbose, ephemeral=ephemeral, noVNC_port=noVNC_port, diff --git a/libs/python/computer/computer/providers/docker/provider.py b/libs/python/computer/computer/providers/docker/provider.py index 28ab9a5f..6aacba48 100644 --- a/libs/python/computer/computer/providers/docker/provider.py +++ b/libs/python/computer/computer/providers/docker/provider.py @@ -41,7 +41,7 @@ class DockerProvider(BaseVMProvider): host: str = "localhost", storage: Optional[str] = None, shared_path: Optional[str] = None, - image: str = "cua-ubuntu:latest", + image: str = "trycua/cua-ubuntu:latest", verbose: bool = False, ephemeral: bool = False, vnc_port: Optional[int] = 6901, @@ -49,17 +49,17 @@ class DockerProvider(BaseVMProvider): """Initialize the Docker VM Provider. Args: - port: Port for the computer-server API (default: 8000) + port: Currently unused (VM provider port) host: Hostname for the API server (default: localhost) storage: Path for persistent VM storage shared_path: Path for shared folder between host and container - image: Docker image to use (default: "cua-ubuntu:latest") + image: Docker image to use (default: "trycua/cua-ubuntu:latest") verbose: Enable verbose logging ephemeral: Use ephemeral (temporary) storage vnc_port: Port for VNC interface (default: 6901) """ self.host = host - self.api_port = 8080 if port is None else port + self.api_port = 8000 self.vnc_port = vnc_port self.ephemeral = ephemeral diff --git a/libs/python/computer/computer/providers/factory.py b/libs/python/computer/computer/providers/factory.py index 6776ed4d..b95c2c61 100644 --- a/libs/python/computer/computer/providers/factory.py +++ b/libs/python/computer/computer/providers/factory.py @@ -147,7 +147,7 @@ class VMProviderFactory: host=host, storage=storage, shared_path=shared_path, - image=image or "cua-ubuntu:latest", + image=image or "trycua/cua-ubuntu:latest", verbose=verbose, ephemeral=ephemeral, vnc_port=noVNC_port