Spaces:
Running
Running
altawil
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -73,25 +73,33 @@ This project follows a decoupled client-server architecture, where the model and
|
|
73 |
|
74 |
## π How to Use
|
75 |
|
76 |
-
Interact with the API by making HTTP requests to its endpoints.
|
77 |
|
78 |
### 1. Start a New Session
|
79 |
This will initialize a new set of tracker and controller instances on the server.
|
|
|
|
|
80 |
```bash
|
81 |
curl -X POST "https://adam-it-baseer-server.hf.space/start_session"
|
82 |
```
|
83 |
|
84 |
-
Response
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
### 2. Run a Simulation Step
|
87 |
|
88 |
-
Send the current camera view and vehicle measurements to be processed.
|
89 |
|
|
|
90 |
```bash
|
91 |
curl -X POST "https://adam-it-baseer-server.hf.space/run_step" \
|
92 |
-H "Content-Type: application/json" \
|
93 |
-d '{
|
94 |
-
"session_id": "
|
95 |
"image_b64": "your-base64-encoded-bgr-image-string",
|
96 |
"measurements": {
|
97 |
"pos_global": [105.0, -20.0],
|
@@ -102,12 +110,57 @@ curl -X POST "https://adam-it-baseer-server.hf.space/run_step" \
|
|
102 |
}'
|
103 |
```
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
### 3. End the Session
|
106 |
|
107 |
This will clean up the session data from the server.
|
108 |
|
|
|
109 |
```bash
|
110 |
-
curl -X POST "https://adam-it-baseer-server.hf.space/end_session?session_id=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
```
|
112 |
|
113 |
---
|
|
|
73 |
|
74 |
## π How to Use
|
75 |
|
76 |
+
Interact with the API by making HTTP requests to its endpoints. The typical workflow is to start a session, run steps in a loop, and then end the session.
|
77 |
|
78 |
### 1. Start a New Session
|
79 |
This will initialize a new set of tracker and controller instances on the server.
|
80 |
+
|
81 |
+
**Request:**
|
82 |
```bash
|
83 |
curl -X POST "https://adam-it-baseer-server.hf.space/start_session"
|
84 |
```
|
85 |
|
86 |
+
**Example Response:**
|
87 |
+
```json
|
88 |
+
{
|
89 |
+
"session_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
|
90 |
+
}
|
91 |
+
```
|
92 |
|
93 |
### 2. Run a Simulation Step
|
94 |
|
95 |
+
Send the current camera view and vehicle measurements to be processed. The API will return control commands and a full analysis.
|
96 |
|
97 |
+
**Request:**
|
98 |
```bash
|
99 |
curl -X POST "https://adam-it-baseer-server.hf.space/run_step" \
|
100 |
-H "Content-Type: application/json" \
|
101 |
-d '{
|
102 |
+
"session_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
|
103 |
"image_b64": "your-base64-encoded-bgr-image-string",
|
104 |
"measurements": {
|
105 |
"pos_global": [105.0, -20.0],
|
|
|
110 |
}'
|
111 |
```
|
112 |
|
113 |
+
**Example Response:**
|
114 |
+
```json
|
115 |
+
{
|
116 |
+
"control_commands": {
|
117 |
+
"steer": 0.05,
|
118 |
+
"throttle": 0.6,
|
119 |
+
"brake": false
|
120 |
+
},
|
121 |
+
"scene_analysis": {
|
122 |
+
"is_junction": 0.02,
|
123 |
+
"traffic_light_state": 0.95,
|
124 |
+
"stop_sign": 0.01
|
125 |
+
},
|
126 |
+
"predicted_waypoints": [
|
127 |
+
[1.0, 0.05],
|
128 |
+
[2.0, 0.06],
|
129 |
+
[3.0, 0.07],
|
130 |
+
[4.0, 0.07],
|
131 |
+
[5.0, 0.08],
|
132 |
+
[6.0, 0.08],
|
133 |
+
[7.0, 0.09],
|
134 |
+
[8.0, 0.09],
|
135 |
+
[9.0, 0.10],
|
136 |
+
[10.0, 0.10]
|
137 |
+
],
|
138 |
+
"dashboard_b64": "a-very-long-base64-string-representing-the-dashboard-image...",
|
139 |
+
"reason": "Red Light"
|
140 |
+
}
|
141 |
+
```
|
142 |
+
|
143 |
+
**Response Fields:**
|
144 |
+
- **`control_commands`**: The final commands to be applied to the vehicle.
|
145 |
+
- **`scene_analysis`**: Probabilities for different road hazards. A high `traffic_light_state` value (e.g., > 0.5) indicates a red light.
|
146 |
+
- **`predicted_waypoints`**: The model's intended path, relative to the vehicle.
|
147 |
+
- **`dashboard_b64`**: A Base64-encoded JPEG image of the full dashboard view, which can be directly displayed in a client application.
|
148 |
+
- **`reason`**: A human-readable string explaining the primary reason for the control action (e.g., "Following ID 12", "Red Light", "Cruising").
|
149 |
+
|
150 |
### 3. End the Session
|
151 |
|
152 |
This will clean up the session data from the server.
|
153 |
|
154 |
+
**Request:**
|
155 |
```bash
|
156 |
+
curl -X POST "https://adam-it-baseer-server.hf.space/end_session?session_id=a1b2c3d4-e5f6-7890-1234-567890abcdef"
|
157 |
+
```
|
158 |
+
|
159 |
+
**Example Response:**
|
160 |
+
```json
|
161 |
+
{
|
162 |
+
"message": "Session a1b2c3d4-e5f6-7890-1234-567890abcdef ended."
|
163 |
+
}
|
164 |
```
|
165 |
|
166 |
---
|