Spaces:
Running
Running
RemiFabre commited on
Commit ·
46fd62d
1
Parent(s): 057dafb
Test: use conv app's full README (10.5KB)
Browse files
README.md
CHANGED
|
@@ -1,27 +1,231 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
| 8 |
tags:
|
| 9 |
-
|
| 10 |
-
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- Edit instructions `_test_conv_pipe_locked_profile/instructions.txt`
|
| 19 |
-
- Edit available tools in `_test_conv_pipe_locked_profile/tools.txt`
|
| 20 |
-
- You can create your own tools in `_test_conv_pipe_locked_profile` by subclassing the `Tool` class.
|
| 21 |
|
| 22 |
-
|
| 23 |
-
- this `README.md` file
|
| 24 |
-
- the `index.html` file (Hugging Face Spaces landing page)
|
| 25 |
-
- the `src/test_conv_pipe/static/index.html` (the web app parameters page)
|
| 26 |
|
| 27 |
-
The
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Reachy Mini Conversation App
|
| 3 |
+
emoji: 🎤
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
short_description: Talk with Reachy Mini !
|
| 9 |
tags:
|
| 10 |
+
- reachy_mini
|
| 11 |
+
- reachy_mini_python_app
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Reachy Mini conversation app
|
| 15 |
|
| 16 |
+
Conversational app for the Reachy Mini robot combining OpenAI's realtime APIs, vision pipelines, and choreographed motion libraries.
|
| 17 |
|
| 18 |
+

|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
## Architecture
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
The app follows a layered architecture connecting the user, AI services, and robot hardware:
|
| 23 |
+
|
| 24 |
+
<p align="center">
|
| 25 |
+
<img src="docs/assets/conversation_app_arch.svg" alt="Architecture Diagram" width="600"/>
|
| 26 |
+
</p>
|
| 27 |
+
|
| 28 |
+
## Overview
|
| 29 |
+
- Real-time audio conversation loop powered by the OpenAI realtime API and `fastrtc` for low-latency streaming.
|
| 30 |
+
- Vision processing uses gpt-realtime by default (when camera tool is used), with optional local vision processing using SmolVLM2 model running on-device (CPU/GPU/MPS) via `--local-vision` flag.
|
| 31 |
+
- Layered motion system queues primary moves (dances, emotions, goto poses, breathing) while blending speech-reactive wobble and face-tracking.
|
| 32 |
+
- Async tool dispatch integrates robot motion, camera capture, and optional face-tracking capabilities through a Gradio web UI with live transcripts.
|
| 33 |
+
|
| 34 |
+
## Installation
|
| 35 |
+
|
| 36 |
+
> [!IMPORTANT]
|
| 37 |
+
> Before using this app, you need to install [Reachy Mini's SDK](https://github.com/pollen-robotics/reachy_mini/).<br>
|
| 38 |
+
> Windows support is currently experimental and has not been extensively tested. Use with caution.
|
| 39 |
+
|
| 40 |
+
### Using uv
|
| 41 |
+
You can set up the project quickly using [uv](https://docs.astral.sh/uv/):
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
uv venv --python 3.12.1 # Create a virtual environment with Python 3.12.1
|
| 45 |
+
source .venv/bin/activate
|
| 46 |
+
uv sync
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
> [!NOTE]
|
| 50 |
+
> To reproduce the exact dependency set from this repo's `uv.lock`, run `uv sync` with `--locked` (or `--frozen`). This ensures `uv` installs directly from the lockfile without re-resolving or updating any versions.
|
| 51 |
+
|
| 52 |
+
To include optional dependencies:
|
| 53 |
+
```
|
| 54 |
+
uv sync --extra reachy_mini_wireless # For wireless Reachy Mini with GStreamer support
|
| 55 |
+
uv sync --extra local_vision # For local PyTorch/Transformers vision
|
| 56 |
+
uv sync --extra yolo_vision # For YOLO-based vision
|
| 57 |
+
uv sync --extra mediapipe_vision # For MediaPipe-based vision
|
| 58 |
+
uv sync --extra all_vision # For all vision features
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
You can combine extras or include dev dependencies:
|
| 62 |
+
```
|
| 63 |
+
uv sync --extra all_vision --group dev
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### Using pip
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python -m venv .venv # Create a virtual environment
|
| 70 |
+
source .venv/bin/activate
|
| 71 |
+
pip install -e .
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Install optional extras depending on the feature set you need:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
# Wireless Reachy Mini support
|
| 78 |
+
pip install -e .[reachy_mini_wireless]
|
| 79 |
+
|
| 80 |
+
# Vision stacks (choose at least one if you plan to run face tracking)
|
| 81 |
+
pip install -e .[local_vision]
|
| 82 |
+
pip install -e .[yolo_vision]
|
| 83 |
+
pip install -e .[mediapipe_vision]
|
| 84 |
+
pip install -e .[all_vision] # installs every vision extra
|
| 85 |
+
|
| 86 |
+
# Tooling for development workflows
|
| 87 |
+
pip install -e .[dev]
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
Some wheels (e.g. PyTorch) are large and require compatible CUDA or CPU builds—make sure your platform matches the binaries pulled in by each extra.
|
| 91 |
+
|
| 92 |
+
## Optional dependency groups
|
| 93 |
+
|
| 94 |
+
| Extra | Purpose | Notes |
|
| 95 |
+
|-------|---------|-------|
|
| 96 |
+
| `reachy_mini_wireless` | Wireless Reachy Mini with GStreamer support. | Required for wireless versions of Reachy Mini, includes GStreamer dependencies.
|
| 97 |
+
| `local_vision` | Run the local VLM (SmolVLM2) through PyTorch/Transformers. | GPU recommended; ensure compatible PyTorch builds for your platform.
|
| 98 |
+
| `yolo_vision` | YOLOv8 tracking via `ultralytics` and `supervision`. | CPU friendly; supports the `--head-tracker yolo` option.
|
| 99 |
+
| `mediapipe_vision` | Lightweight landmark tracking with MediaPipe. | Works on CPU; enables `--head-tracker mediapipe`.
|
| 100 |
+
| `all_vision` | Convenience alias installing every vision extra. | Install when you want the flexibility to experiment with every provider.
|
| 101 |
+
| `dev` | Developer tooling (`pytest`, `ruff`). | Add on top of either base or `all_vision` environments.
|
| 102 |
+
|
| 103 |
+
## Configuration
|
| 104 |
+
|
| 105 |
+
1. Copy `.env.example` to `.env`.
|
| 106 |
+
2. Fill in the required values, notably the OpenAI API key.
|
| 107 |
+
|
| 108 |
+
| Variable | Description |
|
| 109 |
+
|----------|-------------|
|
| 110 |
+
| `OPENAI_API_KEY` | Required. Grants access to the OpenAI realtime endpoint.
|
| 111 |
+
| `MODEL_NAME` | Override the realtime model (defaults to `gpt-realtime`). Used for both conversation and vision (unless `--local-vision` flag is used).
|
| 112 |
+
| `HF_HOME` | Cache directory for local Hugging Face downloads (only used with `--local-vision` flag, defaults to `./cache`).
|
| 113 |
+
| `HF_TOKEN` | Optional token for Hugging Face models (only used with `--local-vision` flag, falls back to `huggingface-cli login`).
|
| 114 |
+
| `LOCAL_VISION_MODEL` | Hugging Face model path for local vision processing (only used with `--local-vision` flag, defaults to `HuggingFaceTB/SmolVLM2-2.2B-Instruct`).
|
| 115 |
+
|
| 116 |
+
## Running the app
|
| 117 |
+
|
| 118 |
+
Activate your virtual environment, ensure the Reachy Mini robot (or simulator) is reachable, then launch:
|
| 119 |
+
|
| 120 |
+
```bash
|
| 121 |
+
reachy-mini-conversation-app
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
By default, the app runs in console mode for direct audio interaction. Use the `--gradio` flag to launch a web UI served locally at http://127.0.0.1:7860/ (required when running in simulation mode). With a camera attached, vision is handled by the gpt-realtime model when the camera tool is used. For local vision processing, use the `--local-vision` flag to process frames periodically using the SmolVLM2 model. Additionally, you can enable face tracking via YOLO or MediaPipe pipelines depending on the extras you installed.
|
| 125 |
+
|
| 126 |
+
### CLI options
|
| 127 |
+
|
| 128 |
+
| Option | Default | Description |
|
| 129 |
+
|--------|---------|-------------|
|
| 130 |
+
| `--head-tracker {yolo,mediapipe}` | `None` | Select a face-tracking backend when a camera is available. YOLO is implemented locally, MediaPipe comes from the `reachy_mini_toolbox` package. Requires the matching optional extra. |
|
| 131 |
+
| `--no-camera` | `False` | Run without camera capture or face tracking. |
|
| 132 |
+
| `--local-vision` | `False` | Use local vision model (SmolVLM2) for periodic image processing instead of gpt-realtime vision. Requires `local_vision` extra to be installed. |
|
| 133 |
+
| `--gradio` | `False` | Launch the Gradio web UI. Without this flag, runs in console mode. Required when running in simulation mode. |
|
| 134 |
+
| `--debug` | `False` | Enable verbose logging for troubleshooting. |
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
### Examples
|
| 138 |
+
- Run on hardware with MediaPipe face tracking:
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
reachy-mini-conversation-app --head-tracker mediapipe
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
- Run with local vision processing (requires `local_vision` extra):
|
| 145 |
+
|
| 146 |
+
```bash
|
| 147 |
+
reachy-mini-conversation-app --local-vision
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
- Disable the camera pipeline (audio-only conversation):
|
| 151 |
+
|
| 152 |
+
```bash
|
| 153 |
+
reachy-mini-conversation-app --no-camera
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
- Run with Gradio web interface:
|
| 157 |
+
|
| 158 |
+
```bash
|
| 159 |
+
reachy-mini-conversation-app --gradio
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
### Troubleshooting
|
| 163 |
+
|
| 164 |
+
- Timeout error:
|
| 165 |
+
If you get an error like this:
|
| 166 |
+
```bash
|
| 167 |
+
TimeoutError: Timeout while waiting for connection with the server.
|
| 168 |
+
```
|
| 169 |
+
It probably means that the Reachy Mini's daemon isn't running. Install [Reachy Mini's SDK](https://github.com/pollen-robotics/reachy_mini/) and start the daemon.
|
| 170 |
+
|
| 171 |
+
## LLM tools exposed to the assistant
|
| 172 |
+
|
| 173 |
+
| Tool | Action | Dependencies |
|
| 174 |
+
|------|--------|--------------|
|
| 175 |
+
| `move_head` | Queue a head pose change (left/right/up/down/front). | Core install only. |
|
| 176 |
+
| `camera` | Capture the latest camera frame and send it to gpt-realtime for vision analysis. | Requires camera worker; uses gpt-realtime vision by default. |
|
| 177 |
+
| `head_tracking` | Enable or disable face-tracking offsets (not facial recognition - only detects and tracks face position). | Camera worker with configured head tracker. |
|
| 178 |
+
| `dance` | Queue a dance from `reachy_mini_dances_library`. | Core install only. |
|
| 179 |
+
| `stop_dance` | Clear queued dances. | Core install only. |
|
| 180 |
+
| `play_emotion` | Play a recorded emotion clip via Hugging Face assets. | Needs `HF_TOKEN` for the recorded emotions dataset. |
|
| 181 |
+
| `stop_emotion` | Clear queued emotions. | Core install only. |
|
| 182 |
+
| `do_nothing` | Explicitly remain idle. | Core install only. |
|
| 183 |
+
|
| 184 |
+
## Using custom profiles
|
| 185 |
+
Create custom profiles with dedicated instructions and enabled tools!
|
| 186 |
+
|
| 187 |
+
Set `REACHY_MINI_CUSTOM_PROFILE=<name>` to load `src/reachy_mini_conversation_app/profiles/<name>/` (see `.env.example`). If unset, the `default` profile is used.
|
| 188 |
+
|
| 189 |
+
Each profile requires two files: `instructions.txt` (prompt text) and `tools.txt` (list of allowed tools), and optionally contains custom tools implementations.
|
| 190 |
+
|
| 191 |
+
### Custom instructions
|
| 192 |
+
Write plain-text prompts in `instructions.txt`. To reuse shared prompt pieces, add lines like:
|
| 193 |
+
```
|
| 194 |
+
[passion_for_lobster_jokes]
|
| 195 |
+
[identities/witty_identity]
|
| 196 |
+
```
|
| 197 |
+
Each placeholder pulls the matching file under `src/reachy_mini_conversation_app/prompts/` (nested paths allowed). See `src/reachy_mini_conversation_app/profiles/example/` for a reference layout.
|
| 198 |
+
|
| 199 |
+
### Enabling tools
|
| 200 |
+
List enabled tools in `tools.txt`, one per line; prefix with `#` to comment out. For example:
|
| 201 |
+
|
| 202 |
+
```
|
| 203 |
+
play_emotion
|
| 204 |
+
# move_head
|
| 205 |
+
|
| 206 |
+
# My custom tool defined locally
|
| 207 |
+
sweep_look
|
| 208 |
+
```
|
| 209 |
+
Tools are resolved first from Python files in the profile folder (custom tools), then from the shared library `src/reachy_mini_conversation_app/tools/` (e.g., `dance`, `head_tracking`).
|
| 210 |
+
|
| 211 |
+
### Custom tools
|
| 212 |
+
On top of built-in tools found in the shared library, you can implement custom tools specific to your profile by adding Python files in the profile folder.
|
| 213 |
+
Custom tools must subclass `reachy_mini_conversation_app.tools.core_tools.Tool` (see `profiles/example/sweep_look.py`).
|
| 214 |
+
|
| 215 |
+
### Edit personalities from the UI
|
| 216 |
+
When running with `--gradio`, open the “Personality” accordion:
|
| 217 |
+
- Select among available profiles (folders under `src/reachy_mini_conversation_app/profiles/`) or the built‑in default.
|
| 218 |
+
- Click “Apply” to update the current session instructions live.
|
| 219 |
+
- Create a new personality by entering a name and instructions text; it stores files under `profiles/<name>/` and copies `tools.txt` from the `default` profile.
|
| 220 |
+
|
| 221 |
+
Note: The “Personality” panel updates the conversation instructions. Tool sets are loaded at startup from `tools.txt` and are not hot‑reloaded.
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
## Development workflow
|
| 225 |
+
- Install the dev group extras: `uv sync --group dev` or `pip install -e .[dev]`.
|
| 226 |
+
- Run formatting and linting: `ruff check .`.
|
| 227 |
+
- Execute the test suite: `pytest`.
|
| 228 |
+
- When iterating on robot motions, keep the control loop responsive => offload blocking work using the helpers in `tools.py`.
|
| 229 |
+
|
| 230 |
+
## License
|
| 231 |
+
Apache 2.0
|