Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,10 +1,115 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
-
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: VNC Desktop + Browser Automation
|
| 3 |
+
emoji: 🖥️
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# Linux Desktop with VNC + Browser Automation
|
| 11 |
+
|
| 12 |
+
Full XFCE desktop with Playwright, Puppeteer, and CDP for AI agent control.
|
| 13 |
+
|
| 14 |
+
## Features
|
| 15 |
+
|
| 16 |
+
| Component | Description |
|
| 17 |
+
|-----------|-------------|
|
| 18 |
+
| **XFCE4 Desktop** | Full Linux desktop via noVNC |
|
| 19 |
+
| **Chrome + CDP** | Chrome DevTools Protocol on port 9222 |
|
| 20 |
+
| **Playwright** | Cross-browser automation (Chromium, Firefox, WebKit) |
|
| 21 |
+
| **Puppeteer** | Chrome/Chromium automation |
|
| 22 |
+
| **MCP Servers** | Model Context Protocol integration |
|
| 23 |
+
| **CDP REST API** | HTTP endpoints for browser control |
|
| 24 |
+
|
| 25 |
+
## Endpoints
|
| 26 |
+
|
| 27 |
+
| Port | Service | Access |
|
| 28 |
+
|------|---------|--------|
|
| 29 |
+
| 7860 | noVNC Desktop | Browser (main UI) |
|
| 30 |
+
| 8000 | CDP REST API | `https://SPACE.hf.space/api/` |
|
| 31 |
+
| 9222 | Chrome CDP | WebSocket |
|
| 32 |
+
|
| 33 |
+
## API Usage
|
| 34 |
+
|
| 35 |
+
### Navigate
|
| 36 |
+
```bash
|
| 37 |
+
curl -X POST https://SPACE.hf.space:8000/navigate \
|
| 38 |
+
-H "Content-Type: application/json" \
|
| 39 |
+
-d '{"url": "https://example.com"}'
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
### Screenshot
|
| 43 |
+
```bash
|
| 44 |
+
curl -X POST https://SPACE.hf.space:8000/screenshot \
|
| 45 |
+
-H "Content-Type: application/json" \
|
| 46 |
+
-d '{"full_page": false}'
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
### Click Element
|
| 50 |
+
```bash
|
| 51 |
+
curl -X POST https://SPACE.hf.space:8000/click \
|
| 52 |
+
-H "Content-Type: application/json" \
|
| 53 |
+
-d '{"selector": "#button-id"}'
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
### Type Text
|
| 57 |
+
```bash
|
| 58 |
+
curl -X POST https://SPACE.hf.space:8000/type \
|
| 59 |
+
-H "Content-Type: application/json" \
|
| 60 |
+
-d '{"selector": "input[name=search]", "text": "hello world"}'
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Execute JavaScript
|
| 64 |
+
```bash
|
| 65 |
+
curl -X POST https://SPACE.hf.space:8000/evaluate \
|
| 66 |
+
-H "Content-Type: application/json" \
|
| 67 |
+
-d '{"expression": "document.title"}'
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## MCP Integration
|
| 71 |
+
|
| 72 |
+
Configure in Claude Desktop or other MCP clients:
|
| 73 |
+
|
| 74 |
+
```json
|
| 75 |
+
{
|
| 76 |
+
"mcpServers": {
|
| 77 |
+
"browser": {
|
| 78 |
+
"command": "npx",
|
| 79 |
+
"args": ["-y", "@anthropic/mcp-server-puppeteer"],
|
| 80 |
+
"env": {
|
| 81 |
+
"PUPPETEER_EXECUTABLE_PATH": "/usr/bin/google-chrome-stable"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Python Agent Example
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
from browser_agent import BrowserAgent
|
| 92 |
+
import asyncio
|
| 93 |
+
|
| 94 |
+
async def main():
|
| 95 |
+
agent = BrowserAgent()
|
| 96 |
+
await agent.start()
|
| 97 |
+
|
| 98 |
+
await agent.goto("https://google.com")
|
| 99 |
+
await agent.type("textarea[name=q]", "AI automation")
|
| 100 |
+
await agent.press("Enter")
|
| 101 |
+
|
| 102 |
+
screenshot = await agent.screenshot()
|
| 103 |
+
|
| 104 |
+
await agent.stop()
|
| 105 |
+
|
| 106 |
+
asyncio.run(main())
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## Environment Variables
|
| 110 |
+
|
| 111 |
+
| Variable | Default | Description |
|
| 112 |
+
|----------|---------|-------------|
|
| 113 |
+
| VNC_RESOLUTION | 1280x720 | Desktop resolution |
|
| 114 |
+
| VNC_PASSWORD | vncpassword | VNC access password |
|
| 115 |
+
| CHROME_CDP_PORT | 9222 | CDP WebSocket port |
|