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.

added mlx conditional in ui

Dillon DuPontc81cdeef94c7
diff --git a/libs/agent/agent/ui/gradio/app.py b/libs/agent/agent/ui/gradio/app.py
index 98d115a0bb..800ece8204 100644
--- a/libs/agent/agent/ui/gradio/app.py
+++ b/libs/agent/agent/ui/gradio/app.py
@@ -130,6 +130,9 @@ class GradioChatScreenshotHandler(DefaultCallbackHandler):
)
+# Detect if current device is MacOS
+is_mac = platform.system().lower() == "darwin"
+
# Map model names to specific provider model names
MODEL_MAPPINGS = {
"openai": {
@@ -166,7 +169,7 @@ MODEL_MAPPINGS = {
},
"uitars": {
# UI-TARS models using MLXVLM provider
- "default": "mlx-community/UI-TARS-1.5-7B-4bit",
+ "default": "mlx-community/UI-TARS-1.5-7B-4bit" if is_mac else "tgi",
"mlx-community/UI-TARS-1.5-7B-4bit": "mlx-community/UI-TARS-1.5-7B-4bit",
"mlx-community/UI-TARS-1.5-7B-6bit": "mlx-community/UI-TARS-1.5-7B-6bit"
},
@@ -476,16 +479,18 @@ def create_gradio_ui(
if ollama_models:
omni_models += ollama_models
+ # Detect if current device is MacOS
+ is_mac = platform.system().lower() == "darwin"
+
# Format model choices
provider_to_models = {
"OPENAI": openai_models,
"ANTHROPIC": anthropic_models,
"OMNI": omni_models + ["Custom model (OpenAI compatible API)", "Custom model (ollama)"], # Add custom model options
- "UITARS": [
+ "UITARS": ([
"mlx-community/UI-TARS-1.5-7B-4bit",
"mlx-community/UI-TARS-1.5-7B-6bit",
- "Custom model (OpenAI compatible API)"
- ], # UI-TARS options with MLX models
+ ] if is_mac else []) + ["Custom model (OpenAI compatible API)"], # UI-TARS options with MLX models
}
# --- Apply Saved Settings (override defaults if available) ---