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.

Automatically create .env file in notebook

James Murdza1aca04300611
diff --git a/notebooks/hud_hackathon.ipynb b/notebooks/hud_hackathon.ipynb
index 560dd2e569..dbc8103e76 100644
--- a/notebooks/hud_hackathon.ipynb
+++ b/notebooks/hud_hackathon.ipynb
@@ -30,10 +30,19 @@
"1. Create a Cua account at https://www.trycua.com/\n",
"2. Start a Cua container at https://www.trycua.com/dashboard/containers\n",
"3. Create a HUD account at https://www.hud.so/\n",
- "4. Create a .env file like this:\n",
+ "4. Create a .env file:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "1757f145",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Create a .env file if it doesn't exist\n",
"\n",
- "```\n",
- "# Required environment variables:\n",
+ "ENV_TEMPLATE = \"\"\"# Required environment variables:\n",
"CUA_API_KEY=\n",
"CUA_CONTAINER_NAME=\n",
"HUD_API_KEY=\n",
@@ -41,7 +50,19 @@
"# Any LLM provider will work:\n",
"ANTHROPIC_API_KEY=\n",
"OPENAI_API_KEY=\n",
- "```"
+ "\"\"\"\n",
+ "\n",
+ "import os\n",
+ "if not os.path.exists(\".env\"):\n",
+ " open(\".env\", \"w\").write(ENV_TEMPLATE)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0949908d",
+ "metadata": {},
+ "source": [
+ "5. Fill in all missing values in the .env file"
]
},
{