How mohamedelsayedelbadwy/cliniq-ai-service works
ClinIQ AI Service is a FastAPI backend with two user-facing capabilities: turn-based Voice Call and Brain MRI image classification. The voice workflow records browser audio, submits a turn with conversation history, runs Groq transcription, response generation, and speech synthesis, then returns text and audio for playback. The MRI workflow accepts an image upload, checks predictor availability, preprocesses the image, and returns model-class probabilities. The graph reflects the sampled implementation and documented endpoints; it does not include the separate class-mapping verification utility or the README’s future RAG idea.
Main entry points: voice/service.py Voice turn service · mri/service.py MRI predictor · main.py FastAPI app · router.py Voice endpoint
Components 16
Service hosting
- FastAPI app
main.py
Voice interface
- Voice Call UI
web/app.js
Voice pipeline
- Voice endpoint
voice/router.py - Voice response
voice/schemas.py - Voice turn service
voice/service.py - Groq settings
voice/config.py
MRI classification
- MRI endpoints
mri/router.py - MRI responses
mri/schemas.py - MRI predictor
mri/service.py - MRI settings
mri/config.py - MRI model weights
models/mri_xception_selective_finetuning_best.keras - Class mapping
models/class_names.json
Other components
- Browser user
- Groq transcription
- Groq language model
- Groq speech synthesis
Connections 18
- FastAPI app → Voice endpoint: mounts routes
main.py - FastAPI app → MRI endpoints: mounts routes
main.py - FastAPI app → MRI predictor: initializes predictor
main.py - FastAPI app → Voice Call UI: serves interface
main.py - Browser user → Voice Call UI: uses
- Voice Call UI → Voice endpoint: posts audio turn
web/app.js - Voice endpoint → Voice turn service: processes turn
voice/router.py - Voice endpoint → Voice response: returns response
voice/router.py - Voice turn service → Groq settings: loads settings
voice/service.py - Voice turn service → Groq transcription: transcribes audio
voice/service.py - Voice turn service → Groq language model: generates reply
voice/service.py - Voice turn service → Groq speech synthesis: synthesizes speech
voice/service.py - Browser user → MRI endpoints: uploads scan
- MRI endpoints → MRI predictor: requests prediction
mri/router.py - MRI endpoints → MRI responses: returns response
mri/router.py - MRI predictor → MRI settings: finds artifacts
mri/service.py - MRI predictor → MRI model weights: loads model
- MRI predictor → Class mapping: loads labels