AI Vision model integration guide
This site has two modes:Demo modeNo login required, use sample data;Live ModeLog in with your SCORE Academy account; hazard reports/corrections/inspections are saved on this device by account. Visual recognition offers three channels: example scenarios, your own real vision model (BYOK), and browser-local pixel rule analysis.
Capability mapping
| Product Features | Current implementation | Invocation method | Remarks |
|---|---|---|---|
| Photo / image hazard detection | Real vision model (BYOK) or local pixel rules | /chat/completions Compatible API | Use real model after configuring Key |
| Video inspection | Frame extraction + frame-by-frame visual recognition | Max 3 frames call your model | Multiple frames incur multiple charges |
| Example scenario | Preset examples | Do not call the model | Always label as 'Example' |
| Regulation search / OCR / Speech-to-text | Demo example / Requires backend proxy | This site has no backend and is not connected to | Do not fabricate results |
Real model integration and key security
On the 'Hazard Reporting' page, click '⚙️ AI Model settings (with built-in Key)", fill in provider Base URL, vision model name and your own Key. Browser connects directly to OpenAI-compatible /chat/completions Interface:
Your browser (camera / upload) │ ① Convert image to base64, attach your Key and POST directly ▼ Your selected service provider (Tongyi Qianwen / Zhipu / Moonshot / OpenAI / custom compatible API) │ ② Use your account's model and quota to return recognition results ▼ Browser display result → Live ModeThe following can be written into a corrective action form(Stored on this device only) This site's server does not accept、Not saved、Will not forward your API Key and images。
Note:Key Saved in this browser's localStorage,People who can access this browser on the same device can see it;Do not fill in on public computers。ModelInvokeCost will be charged to your model account。If the service provider does not enable browser CORS(CORS),Connection test will show a clear error,ReplaceableCompatible APIor fallbackLocal pixel analysis。Example scenarioAlways usePreset examples,Will not consume your quota。
① Visual hazard recognition (core)
After configuring the Key, upload a real photo and click "Start AI detection". The actual request sent by the browser is as follows (using Tongyi Qianwen compatible mode as an example):
POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
Authorization: Bearer <Your API Key>
{
"model": "qwen-vl-max",
"messages": [
{ "role": "system", "content": "You are the enterprise safety inspection assistant……Identify based only on visible content……Strictly return JSON },
{ "role": "user", "content": [
{ "type": "text", "text": "Please identify all safety hazards in the image and provide corrective suggestions. },
{ "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,..." } }
]}
]
}
Require model to return {"summary":"...","hazards":[{type,severity,title,confidence,description,suggestion}]};The frontend normalizes level and confidence. If the model returns non-JSON or the call fails, the page shows the specific reason and provides a 'Switch to local pixel analysis' button.
② Video inspection: frame sampling plan
Current mainstream interfaces lack a unified native video understanding protocol, so we use 'frame extraction + image recognition':
Video file │ Extract key frames at fixed intervals (3 frames in this implementation) ▼ Frame-by-frame visual model hazard detection │ ▼ Aggregate and deduplicate → hazard list + frame index location
With BYOK configured, calls your own model per frame (multiple charges); without config, uses browser local pixel rules, clearly labeled as rule inference not AI model result.
Integration steps
Activate the vision model and create an API Key on the selected service provider platform.
Hazard report page → "⚙️ AI Model settings", select preset or fill in custom compatible interface.
Click 'Test Connection' to confirm Key / Model / CORS work, then save.
Upload real photos for identification; in practice mode, results can generate corrective action orders and be saved.