mirror of
https://github.com/trycua/computer.git
synced 2026-05-19 23:49:34 -05:00
Fix ui instructions
This commit is contained in:
@@ -83,12 +83,34 @@ pip install "cua-agent[ui]"
|
||||
|
||||
# Create a simple launcher script
|
||||
```python
|
||||
# launch_ui.py
|
||||
from agent.ui.gradio.app import create_gradio_ui
|
||||
|
||||
app = create_gradio_ui()
|
||||
app.launch(share=False)
|
||||
```
|
||||
|
||||
# Run the launcher
|
||||
python launch_ui.py
|
||||
```
|
||||
|
||||
### Setting up API Keys
|
||||
|
||||
For the Gradio UI to show available models, you need to set API keys as environment variables:
|
||||
|
||||
```bash
|
||||
# For OpenAI models
|
||||
export OPENAI_API_KEY=your_openai_key_here
|
||||
|
||||
# For Anthropic models
|
||||
export ANTHROPIC_API_KEY=your_anthropic_key_here
|
||||
|
||||
# Launch with both keys set
|
||||
OPENAI_API_KEY=your_key ANTHROPIC_API_KEY=your_key python launch_ui.py
|
||||
```
|
||||
|
||||
Without these environment variables, the UI will show "No models available" for the corresponding providers, but you can still use local models with the OMNI loop provider.
|
||||
|
||||
The Gradio UI provides:
|
||||
- Selection of different agent loops (OpenAI, Anthropic, OMNI)
|
||||
- Model selection for each provider
|
||||
|
||||
@@ -54,23 +54,6 @@ LLMModel = LLM
|
||||
Model = LLM
|
||||
|
||||
|
||||
# Default models for each provider
|
||||
PROVIDER_TO_DEFAULT_MODEL: Dict[LLMProvider, str] = {
|
||||
LLMProvider.ANTHROPIC: "claude-3-7-sonnet-20250219",
|
||||
LLMProvider.OPENAI: "gpt-4o",
|
||||
LLMProvider.OLLAMA: "gemma3:4b-it-q4_K_M",
|
||||
LLMProvider.OAICOMPAT: "Qwen2.5-VL-7B-Instruct",
|
||||
}
|
||||
|
||||
# Environment variable names for each provider
|
||||
PROVIDER_TO_ENV_VAR: Dict[LLMProvider, str] = {
|
||||
LLMProvider.ANTHROPIC: "ANTHROPIC_API_KEY",
|
||||
LLMProvider.OPENAI: "OPENAI_API_KEY",
|
||||
LLMProvider.OLLAMA: "none",
|
||||
LLMProvider.OAICOMPAT: "none",
|
||||
}
|
||||
|
||||
|
||||
class AgentResponse(TypedDict, total=False):
|
||||
"""Agent response format."""
|
||||
|
||||
|
||||
@@ -205,23 +205,41 @@
|
||||
"source": [
|
||||
"## Using the Gradio UI\n",
|
||||
"\n",
|
||||
"The agent includes a Gradio-based user interface for easy interaction. To use it:\n",
|
||||
"The agent includes a Gradio-based user interface for easy interaction. To use it:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"# Get API keys from environment or prompt user\n",
|
||||
"anthropic_key = os.getenv(\"ANTHROPIC_API_KEY\") or input(\"Enter your Anthropic API key: \")\n",
|
||||
"openai_key = os.getenv(\"OPENAI_API_KEY\") or input(\"Enter your OpenAI API key: \")\n",
|
||||
"\n",
|
||||
"os.environ[\"ANTHROPIC_API_KEY\"] = anthropic_key\n",
|
||||
"os.environ[\"OPENAI_API_KEY\"] = openai_key"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from agent.ui.gradio.app import create_gradio_ui\n",
|
||||
"\n",
|
||||
"app = create_gradio_ui()\n",
|
||||
"app.launch(share=False)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"The Gradio UI provides:\n",
|
||||
"- Selection of different agent loops (OpenAI, Anthropic, OMNI)"
|
||||
"app.launch(share=False)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "cua",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -235,7 +253,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.11"
|
||||
"version": "3.12.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user