cduss commited on
Commit
b7d5be6
Β·
1 Parent(s): d1ce57e
Files changed (3) hide show
  1. Dockerfile +7 -0
  2. README.md +2 -0
  3. index.html +124 -0
Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+ COPY static/index.html /app/index.html
5
+
6
+ EXPOSE 7860
7
+ CMD ["python", "-m", "http.server", "7860"]
README.md CHANGED
@@ -5,6 +5,8 @@ colorFrom: pink
5
  colorTo: blue
6
  sdk: docker
7
  pinned: false
 
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: blue
6
  sdk: docker
7
  pinned: false
8
+ tags:
9
+ - reachy-mini
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>Reachy Mini Controller</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- important for mobile -->
8
+ <style>
9
+ body {
10
+ font-family: system-ui, sans-serif;
11
+ padding: 1em;
12
+ margin: 0;
13
+ background: #f9f9f9;
14
+ color: #333;
15
+ }
16
+
17
+ h1 {
18
+ font-size: 1.5em;
19
+ text-align: center;
20
+ margin-bottom: 1em;
21
+ }
22
+
23
+ .btn-grid {
24
+ display: grid;
25
+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
26
+ gap: 1em;
27
+ margin-bottom: 1em;
28
+ }
29
+
30
+ button {
31
+ padding: 0.8em;
32
+ font-size: 1em;
33
+ border: none;
34
+ border-radius: 8px;
35
+ cursor: pointer;
36
+ transition: 0.2s;
37
+ width: 100%;
38
+ }
39
+
40
+ button.status {
41
+ background: #2196F3;
42
+ color: white;
43
+ }
44
+
45
+ button.wake {
46
+ background: #4CAF50;
47
+ color: white;
48
+ }
49
+
50
+ button.sleep {
51
+ background: #f44336;
52
+ color: white;
53
+ }
54
+
55
+ button.torque {
56
+ background: #FF9800;
57
+ color: white;
58
+ }
59
+
60
+ button:hover {
61
+ opacity: 0.9;
62
+ }
63
+
64
+ pre {
65
+ background: white;
66
+ padding: 1em;
67
+ border-radius: 8px;
68
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
69
+ overflow-x: auto;
70
+ font-size: 0.9em;
71
+ white-space: pre-wrap;
72
+ word-wrap: break-word;
73
+ }
74
+ </style>
75
+ </head>
76
+
77
+ <body>
78
+ <h1>πŸ€– Reachy Mini Controller</h1>
79
+
80
+ <div class="btn-grid">
81
+ <button class="status" onclick="getStatus()">πŸ” Get Status</button>
82
+ <button class="wake" onclick="sendCommand('/move/play/wake_up')">🌞 Wake Up</button>
83
+ <button class="sleep" onclick="sendCommand('/move/play/goto_sleep')">πŸŒ™ Sleep</button>
84
+ <button class="torque" onclick="sendCommand('/motors/set_mode/enabled')">⚑ Enable Torque</button>
85
+ </div>
86
+
87
+ <pre id="output">Ready...</pre>
88
+
89
+ <script>
90
+ // const API_BASE = "https://192.168.1.96:8000/api"; // change to LAN IP if needed
91
+ const API_BASE = "https://localhost/api"; // change to LAN IP if needed
92
+ const out = document.getElementById("output");
93
+
94
+ async function getStatus() {
95
+ out.textContent = "Fetching status...";
96
+ try {
97
+ const res = await fetch(`${API_BASE}/state/full`);
98
+ if (!res.ok) throw new Error("HTTP " + res.status);
99
+ const data = await res.json();
100
+ out.textContent = JSON.stringify(data, null, 2);
101
+ } catch (err) {
102
+ out.textContent = "❌ Error: " + err;
103
+ }
104
+ }
105
+
106
+ async function sendCommand(endpoint) {
107
+ out.textContent = `Sending POST ${endpoint}...`;
108
+ try {
109
+ const res = await fetch(`${API_BASE}${endpoint}`, {
110
+ method: "POST",
111
+ headers: { "Content-Type": "application/json" },
112
+ body: "{}"
113
+ });
114
+ if (!res.ok) throw new Error("HTTP " + res.status);
115
+ const data = await res.json().catch(() => ({}));
116
+ out.textContent = "βœ… Success:\n" + JSON.stringify(data, null, 2);
117
+ } catch (err) {
118
+ out.textContent = "❌ Error: " + err;
119
+ }
120
+ }
121
+ </script>
122
+ </body>
123
+
124
+ </html>