Analyze video/image streams, diagnose physical problems, and generate structured step-by-step operating guidance. Deliver instructions both visually (displayed markdown) and audibly (TTS spoken aloud).
text
┌─────────────────────────────────────────────────────────────────────┐
│ iaworker PROCESS │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ [1] RECEIVE INPUT │
│ Video file path, image path, or live camera frame │
│ ↓ │
│ [2] ANALYZE (video_analyzer.py) │
│ - Extract key frames │
│ - Identify objects, damage, components │
│ - Detect anomaly patterns (cracks, loose parts, fluid leaks) │
│ - Classify task type (repair / assembly / inspection / debug) │
│ ↓ │
│ [3] GENERATE STEPS (step_engine.py) │
│ - Build ordered, numbered action steps │
│ - Include tool requirements, safety warnings │
│ - Flag prerequisite steps (disconnect power, etc.) │
│ - Estimate difficulty/time for each step │
│ ↓ │
│ [4] DELIVER (speaker.py + display) │
│ - Display formatted markdown step guide │
│ - Speak each step aloud via TTS │
│ - Step-by-step progression (not all at once) │
│ - Wait for user confirmation before advancing (configurable) │
│ │
└─────────────────────────────────────────────────────────────────────┘
bash
python scripts/video_analyzer.py \
--input /path/to/image.jpg \
--task repair \
--lang en \
--speak
bash
python scripts/video_analyzer.py \
--input /path/to/video.mp4 \
--task debug \
--lang en \
--speak \
--step-by-step
bash
python scripts/video_analyzer.py \
--input camera \
--task inspection \
--lang en \
--speak \
--live
Entry point. Analyzes visual input and triggers step generation.
bash
python scripts/video_analyzer.py [options]
Options:
FlagDescriptionDefault--input PATHImage path, video path, or camera for liveRequired--task TYPE``repair, debug, assembly, inspection, auto``auto``--lang CODE``en or zh``en``--speakEnable TTS for step outputDisabled--step-by-stepSpeak and display one step at a time, wait for confirmationSequential mode--liveLive camera mode with continuous analysisOff--output PATHWrite steps to markdown fileNone (console only)--frame-skip NSkip every N frames in video (speed up analysis)10
Task auto-detection:
repair — Something is broken; find damage, suggest fixesdebug — Something isn't working; trace fault to causeassembly — Something needs to be built/put togetherinspection — Check condition, report findingsGenerates structured steps from analysis results.
python
from step_engine import StepEngine
engine = StepEngine(lang="en")
steps = engine.generate(
task_type="repair",
objects=["wheel", "chain", "brake caliper"],
anomalies=["chain loose", "brake pad worn"],
context={"bike_type": "mountain"}
)
for step in steps:
print(step["number"], step["title"])
print(step["description"])
print(f"[Tools: {step['tools']}] [Time: {step['time_estimate']}]")
if step["safety_warning"]:
print(f"⚠️ {step['safety_warning']}")
Step object schema:
python
{
"number": int, # 1-based step number
"title": str, # Short action title
"description": str, # Detailed description
"tools": list[str], # Required tools
"time_estimate": str, # e.g. "5-10 min"
"difficulty": str, # "easy" | "medium" | "hard" | "expert"
"safety_warning": str|null,# Warning text if any
"prerequisite": bool, # Must be done before others proceed
"common_mistakes": list[str],# What to avoid
}
Difficulty classification:
LevelIndicatoreasyNo special tools, minimal riskmediumBasic tools, some disassemblyhardSpecialty tools, significant disassemblyexpertProfessional tools, structural risk
Handles TTS output and markdown display.
python
from speaker import Speaker
speaker = Speaker(lang="en", tts_enabled=True)
speaker.display_and_speak("Step 1: Inspect the chain tensioner")
speaker.display_steps([...steps...])
speaker.speak_only("Make sure to wear safety glasses.")
speaker.wait_for_user("Press Enter when ready to continue")
Features:
rich library--step-by-step mode)Steps must follow this structure:
Rules:
Config file: scripts/config.yaml
yaml
tts:
engine: "gtts" # "gtts" or "pyttsx3"
lang: "en"
speed: 1.0 # 0.5 = slow, 2.0 = fast
volume: 1.0 # 0.0 to 1.0
display:
use_rich: true # Pretty terminal output
color: "cyan" # Step highlight color
show_icons: true # Show ✅ ⚠️ 🔧 icons
analysis:
default_task: "auto"
frame_skip: 10
confidence_threshold: 0.6
step_delivery:
auto_speak: true
wait_confirmation: false
speak_difficulty: true
speak_time_estimate: true
text
🔧 Tools: Hex keys (4mm, 5mm), chain tool, lubricant
⏱ Time: 15-25 min
⚠️ Safety: Flip bike first — chain tension releases can snap
text
🔧 Tools: OBD2 scanner, multimeter, basic socket set
⏱ Time: 20-40 min (diagnosis first)
⚠️ Safety: Disable ignition, disconnect battery negative first
text
🔧 Tools: Hex key (included), Phillips screwdriver, hammer
⏱ Time: varies
⚠️ Safety: Enlist a second person for large panels
gtts is installed: pip install gttsengine: pyttsx3 in config (offline)DISPLAY env var or use pyttsx3--frame-skip (e.g., --frame-skip 30)--input camera --live for real-time with throttled analysis--task repair explicitly if auto-detect failspython scripts/video_analyzer.py --input camera --list-devices--input camera --camera-index 1 if default is wrongiaworker ships with general-purpose analysis. To add domain-specific knowledge:
references/domains/MYDOMAIN.md with known failure modes and tool listsstep_engine.py, add a DOMAIN_HANDLERS map that loads theseExample domain file:
markdown
# Domain: electric_bike
## Common Failures
- Motor controller overheating → reduce load, check ventilation
- Battery BMS cutout → reset via unplugging 30s
- Torque sensor miscalibration → re-zero via display menu
## Safety
- Never open motor housing — high voltage capacitors retain charge
- Battery must be removed before any repair