mirror of
https://github.com/trycua/computer.git
synced 2026-04-28 19:23:23 -05:00
Fixed incorrect port, added docker provider to gradio UI
This commit is contained in:
@@ -187,7 +187,7 @@ if __name__ == "__main__":
|
||||
"""
|
||||
<div style="display: flex; justify-content: center; margin-bottom: 0.5em">
|
||||
<img alt="CUA Logo" style="width: 80px;"
|
||||
src="https://github.com/trycua/cua/blob/main/img/logo_black.png?raw=true" />
|
||||
src="https://github.com/trycua/cua/blob/main/img/logo_white.png?raw=true" />
|
||||
</div>
|
||||
"""
|
||||
)
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user