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.

bump version, add localhost to ui

Dillon DuPont01371ed6cfad
diff --git a/libs/python/agent/agent/ui/gradio/app.py b/libs/python/agent/agent/ui/gradio/app.py
index 13c0786fff..be04d93162 100644
--- a/libs/python/agent/agent/ui/gradio/app.py
+++ b/libs/python/agent/agent/ui/gradio/app.py
@@ -178,13 +178,20 @@ def create_computer_instance(
"""Create or get the global Computer instance."""
global global_computer
if global_computer is None:
- global_computer = Computer(
- verbosity=verbosity,
- os_type=os_type,
- provider_type=provider_type,
- name=name if name else "",
- api_key=api_key
- )
+ if provider_type == "localhost":
+ global_computer = Computer(
+ verbosity=verbosity,
+ os_type=os_type,
+ use_host_computer_server=True
+ )
+ else:
+ global_computer = Computer(
+ verbosity=verbosity,
+ os_type=os_type,
+ provider_type=provider_type,
+ name=name if name else "",
+ api_key=api_key
+ )
return global_computer
diff --git a/libs/python/agent/agent/ui/gradio/ui_components.py b/libs/python/agent/agent/ui/gradio/ui_components.py
index dfcceb4edd..c601fb6c3c 100644
--- a/libs/python/agent/agent/ui/gradio/ui_components.py
+++ b/libs/python/agent/agent/ui/gradio/ui_components.py
@@ -211,7 +211,7 @@ if __name__ == "__main__":
is_windows = platform.system().lower() == "windows"
is_mac = platform.system().lower() == "darwin"
- providers = ["cloud"]
+ providers = ["cloud", "localhost"]
if is_mac:
providers += ["lume"]
if is_windows:
@@ -403,6 +403,23 @@ if __name__ == "__main__":
type="password",
)
+ # Provider visibility update function
+ def update_provider_visibility(provider):
+ """Update visibility of container name and API key based on selected provider."""
+ is_localhost = provider == "localhost"
+ return [
+ gr.update(visible=not is_localhost), # container_name
+ gr.update(visible=not is_localhost and not has_cua_key) # cua_cloud_api_key
+ ]
+
+ # Connect provider change event
+ computer_provider.change(
+ fn=update_provider_visibility,
+ inputs=[computer_provider],
+ outputs=[container_name, cua_cloud_api_key],
+ queue=False
+ )
+
# Connect UI update events
for dropdown in [agent_loop, omni_model_choice, uitars_model_choice, openai_model_choice, anthropic_model_choice]:
dropdown.change(
diff --git a/libs/python/agent/pyproject.toml b/libs/python/agent/pyproject.toml
index be10f72921..1280999b1f 100644
--- a/libs/python/agent/pyproject.toml
+++ b/libs/python/agent/pyproject.toml
@@ -19,7 +19,7 @@ dependencies = [
"pydantic>=2.6.4",
"rich>=13.7.1",
"python-dotenv>=1.0.1",
- "cua-computer>=0.3.0,<0.5.0",
+ "cua-computer>=0.4.0,<0.5.0",
"cua-core>=0.1.8,<0.2.0",
"certifi>=2024.2.2",
"litellm>=1.74.8"
diff --git a/libs/python/computer/pyproject.toml b/libs/python/computer/pyproject.toml
index 2e564fa977..4a9b41bbb1 100644
--- a/libs/python/computer/pyproject.toml
+++ b/libs/python/computer/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "pdm.backend"
[project]
name = "cua-computer"
-version = "0.3.0"
+version = "0.4.0"
description = "Computer-Use Interface (CUI) framework powering Cua"
readme = "README.md"
authors = [