wip
Browse files- README.md +23 -12
- app.py +0 -37
- requirements.txt +0 -1
README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Reachy Mini Simple Control Panel
|
| 2 |
|
| 3 |
A lightweight, static HTML/JS control panel for Reachy Mini robot using WebSockets for real-time control.
|
|
@@ -13,7 +22,17 @@ A lightweight, static HTML/JS control panel for Reachy Mini robot using WebSocke
|
|
| 13 |
|
| 14 |
## How to Use
|
| 15 |
|
| 16 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
Just open `index.html` in your web browser:
|
| 19 |
|
|
@@ -23,9 +42,7 @@ xdg-open index.html # Linux
|
|
| 23 |
start index.html # Windows
|
| 24 |
```
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
### Option 2: Serve with Python (Recommended for HuggingFace Spaces)
|
| 29 |
|
| 30 |
```bash
|
| 31 |
python server.py
|
|
@@ -33,7 +50,7 @@ python server.py
|
|
| 33 |
|
| 34 |
Then open http://localhost:7860 in your browser.
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
```bash
|
| 39 |
# Using Python 3
|
|
@@ -61,16 +78,10 @@ This app uses:
|
|
| 61 |
|
| 62 |
The app automatically connects to the robot when loaded and reconnects if the connection is lost.
|
| 63 |
|
| 64 |
-
## Deployment on HuggingFace Spaces
|
| 65 |
-
|
| 66 |
-
1. Copy `index.html`, `app.js`, and `server.py` to your Space
|
| 67 |
-
2. Set SDK to `gradio` with sdk_version `6.0.0` (only needed for the server)
|
| 68 |
-
3. Or use `static` SDK if HF supports it
|
| 69 |
-
4. Users will need to have the robot daemon accessible from their machine
|
| 70 |
-
|
| 71 |
## Technical Details
|
| 72 |
|
| 73 |
- **Slider Updates**: Use `input` event for real-time updates
|
| 74 |
- **Auto-reconnect**: WebSocket reconnects every 2 seconds if disconnected
|
| 75 |
- **State Management**: Client-side state tracking prevents feedback loops
|
| 76 |
- **Error Handling**: Graceful error messages and automatic recovery
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Reachy Mini Simple Control Panel
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: static
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# Reachy Mini Simple Control Panel
|
| 11 |
|
| 12 |
A lightweight, static HTML/JS control panel for Reachy Mini robot using WebSockets for real-time control.
|
|
|
|
| 22 |
|
| 23 |
## How to Use
|
| 24 |
|
| 25 |
+
### On HuggingFace Spaces
|
| 26 |
+
|
| 27 |
+
Just open the Space - the app will automatically try to connect to your local robot at `localhost:8000`.
|
| 28 |
+
|
| 29 |
+
**Requirements:**
|
| 30 |
+
- Reachy Mini daemon running on `localhost:8000` on your local machine
|
| 31 |
+
- Modern web browser with WebSocket support
|
| 32 |
+
|
| 33 |
+
### Local Testing
|
| 34 |
+
|
| 35 |
+
#### Option 1: Open Directly (Simplest)
|
| 36 |
|
| 37 |
Just open `index.html` in your web browser:
|
| 38 |
|
|
|
|
| 42 |
start index.html # Windows
|
| 43 |
```
|
| 44 |
|
| 45 |
+
#### Option 2: Serve with Python
|
|
|
|
|
|
|
| 46 |
|
| 47 |
```bash
|
| 48 |
python server.py
|
|
|
|
| 50 |
|
| 51 |
Then open http://localhost:7860 in your browser.
|
| 52 |
|
| 53 |
+
#### Option 3: Serve with any HTTP server
|
| 54 |
|
| 55 |
```bash
|
| 56 |
# Using Python 3
|
|
|
|
| 78 |
|
| 79 |
The app automatically connects to the robot when loaded and reconnects if the connection is lost.
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
## Technical Details
|
| 82 |
|
| 83 |
- **Slider Updates**: Use `input` event for real-time updates
|
| 84 |
- **Auto-reconnect**: WebSocket reconnects every 2 seconds if disconnected
|
| 85 |
- **State Management**: Client-side state tracking prevents feedback loops
|
| 86 |
- **Error Handling**: Graceful error messages and automatic recovery
|
| 87 |
+
- **No Backend**: Fully static - runs entirely in the browser
|
app.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Reachy Mini Simple Control Panel - Static File Server for HuggingFace Spaces
|
| 3 |
-
Serves the static HTML/JS control panel that uses WebSockets to connect to localhost:8000
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import gradio as gr
|
| 7 |
-
from pathlib import Path
|
| 8 |
-
|
| 9 |
-
# Get the directory where this file is located
|
| 10 |
-
BASE_DIR = Path(__file__).parent
|
| 11 |
-
|
| 12 |
-
# Read the HTML file
|
| 13 |
-
html_path = BASE_DIR / "index.html"
|
| 14 |
-
js_path = BASE_DIR / "app.js"
|
| 15 |
-
|
| 16 |
-
with open(html_path, 'r') as f:
|
| 17 |
-
html_content = f.read()
|
| 18 |
-
|
| 19 |
-
with open(js_path, 'r') as f:
|
| 20 |
-
js_content = f.read()
|
| 21 |
-
|
| 22 |
-
# Inject JavaScript directly into HTML
|
| 23 |
-
full_html = html_content.replace(
|
| 24 |
-
'<script src="app.js"></script>',
|
| 25 |
-
f'<script>{js_content}</script>'
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
# Create Gradio app with just the HTML
|
| 29 |
-
with gr.Blocks(title="Reachy Mini Simple Control Panel") as app:
|
| 30 |
-
gr.HTML(full_html)
|
| 31 |
-
|
| 32 |
-
if __name__ == "__main__":
|
| 33 |
-
app.launch(
|
| 34 |
-
server_name="0.0.0.0",
|
| 35 |
-
server_port=7860,
|
| 36 |
-
share=False
|
| 37 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
gradio>=6.0.0
|
|
|
|
|
|