Quick Start
Welcome to SegVision! This guide will help you get started with our AI-powered traffic accident detection platform in minutes
Prerequisites
Before you begin, make sure you have:
- A valid SegVision account
- Your API key
Step 1: Get Your API Key
- Register for a SegVision account
- Apply for API Keys
- Create a new API key and securely copy it
Step 2: Make Your First API Call
Here's a simple example using cURL to test our accident detection API:
curl -X POST "http://segvision.satxspace.org/api/qwen-stream" \
-H "Content-Type: application/json" \
-d '{
"imageBase64": "data:image/jpeg;base64,your-image-base64-data",
"prompt": "Detect traffic accidents in the image and return results in JSON format."
}'Step 3: Handle the Response
Since we're using streaming responses, data will be returned gradually. A successful response will look like this:
[
{
"bbox_2d": [125, 245, 380, 412],
"label": ["Traffic Accident"],
"description": "Vehicle collision accident"
}
]
--- Usage ---
{"prompt_tokens": 156, "completion_tokens": 45, "total_tokens": 201}JavaScript Streaming Response Handling Example
const response = await fetch('/api/qwen-stream', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
imageBase64: 'data:image/jpeg;base64,...',
prompt: 'Detect traffic accidents'
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let fullResponse = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
fullResponse += chunk;
console.log(chunk); // Process each streaming data chunk
}
// Parse final JSON result
const jsonResult = JSON.parse(fullResponse.split('\n\n--- Usage ---')[0]);
console.log('Detection result:', jsonResult);