How tobytobyy/dacn2_aiserver works
DACN2 AI Server is a multimodal inference API. A client submits text and optionally an image URL; the chat route fetches the image, routes it through CLIP, analyzes it with the food classifier or health VQA pipeline, then sends the gathered context to the LLM and returns an intent, response, and suggested actions. A separate food-image endpoint exposes food classification. The graph also shows model setup, shared state, security, and readiness. Evidence is limited to the README and indexed excerpts; unsampled implementation details and links are omitted.
Main entry points: inference.py Inference routes · main.py App lifecycle · state.py Model state · food_pipeline.py Food pipeline
Components 24
API and access
- Inference routes
serve/app/api/v1/routes/inference.py - Chat schemas
serve/app/schemas/chat.py - Food schemas
serve/app/schemas/food_image.py - Token security
serve/app/core/security.py - Model readiness
serve/app/core/readiness.py - Image fetch
serve/app/core/fetch_image.py
Vision analysis
- Vision routing
serve/app/domain/vision_router_service.py - CLIP router model
serve/app/infra/clip_router.py - Routing hints
serve/app/domain/routing_hint.py - Food pipeline
serve/app/domain/food_pipeline.py - Food classifier
serve/app/infra/predict_food.py - Health pipeline
serve/app/domain/health_pipeline.py - VQA questions
serve/app/domain/vqa_questions.py - BLIP VQA
serve/app/infra/blip_vqa.py
Language response
- LLM orchestration
serve/app/domain/llm_engine.py - Allowed intents
serve/app/domain/llm_intents.py - Ollama client
serve/app/infra/llm_ollama.py - Suggested actions
serve/app/domain/actions.py
Runtime foundation
- App lifecycle
serve/app/main.py - Configuration
serve/app/core/config.py - Model state
serve/app/core/state.py
Other components
- API client
- Image URL host
- Ollama service
Connections 31
- API client → Inference routes: submits request
README.md - Inference routes → Token security: checks token
serve/app/api/v1/routes/inference.py - Inference routes → Model readiness: checks readiness
serve/app/api/v1/routes/inference.py - Inference routes → Chat schemas: validates chat
serve/app/api/v1/routes/inference.py - Inference routes → Food schemas: validates food request
serve/app/api/v1/routes/inference.py - Inference routes → Image fetch: fetches image
serve/app/api/v1/routes/inference.py - Image fetch → Image URL host: downloads image
- Inference routes → Vision routing: routes image
serve/app/api/v1/routes/inference.py - Vision routing → Model state: uses model state
serve/app/domain/vision_router_service.py - App lifecycle → CLIP router model: loads CLIP
serve/app/main.py - App lifecycle → Model state: stores models
serve/app/main.py - Vision routing → Configuration: reads thresholds
serve/app/domain/vision_router_service.py - Inference routes → Routing hints: maps route
serve/app/api/v1/routes/inference.py - Inference routes → Food pipeline: analyzes food
serve/app/api/v1/routes/inference.py - Food pipeline → Food classifier: predicts labels
serve/app/domain/food_pipeline.py - App lifecycle → Food pipeline: initializes pipeline
serve/app/main.py - Food pipeline → Model state: uses model state
serve/app/domain/food_pipeline.py - Inference routes → Health pipeline: analyzes health image
serve/app/api/v1/routes/inference.py - Health pipeline → VQA questions: selects questions
serve/app/domain/health_pipeline.py - Health pipeline → BLIP VQA: asks questions
serve/app/domain/health_pipeline.py - BLIP VQA → Model state: uses model state
serve/app/infra/blip_vqa.py - App lifecycle → Health pipeline: initializes pipeline
serve/app/main.py - Inference routes → LLM orchestration: generates response
serve/app/api/v1/routes/inference.py - LLM orchestration → Allowed intents: validates intent
serve/app/domain/llm_engine.py - LLM orchestration → Ollama client: requests generation
serve/app/domain/llm_engine.py - Ollama client → Ollama service: sends chat
serve/app/infra/llm_ollama.py - App lifecycle → LLM orchestration: initializes engine
serve/app/main.py - Inference routes → Suggested actions: builds actions
serve/app/api/v1/routes/inference.py - App lifecycle → Configuration: reads settings
serve/app/main.py - Token security → Configuration: reads token config
serve/app/core/security.py - Model readiness → Model state: checks model state
serve/app/core/readiness.py