Inspiration
Medical students learn history-taking and breaking bad news by practising on simulated patients: trained actors who are paid by the hour, hard to book and always in short supply. Every slot counts, so students arrive nervous and get only a handful of tries. We wanted a patient you can practise on as often as you like, at 11 pm, with nobody watching, who still feels like a person: someone who answers in his own words, gets anxious or defensive, and only tells you about his twin brother's heart attack if you think to ask.
What it does
Solivea is a virtual patient you talk to out loud, like a video call.
- A real conversation: hold Space, ask a question, and the patient answers in a natural, emotional voice with a live, lip-synced face. His expression shifts with his mood (anxious, sad, in pain, frustrated, relieved), he nods, looks away or down, and he never freezes between answers.
- A consistent patient: each case has a full medical background, a personality and hidden facts (smoking, medication he forgot, family history). The patient only reveals them when the student asks the right question, in lay language, and never contradicts himself. Easy, medium and hard settings change how much he volunteers.
- Bedside tools: check blood pressure, pulse and oxygen, listen with the stethoscope, and examine the belly region by region.
- The patient reads you: with the webcam on, Solivea notices whether the student smiles, looks worried or keeps eye contact, all processed on the device, and the patient reacts to it.
- Feedback after the talk: every question is graded in the background while you talk. At the end you get a scored report of what you covered, what you missed, and whether you behaved professionally, plus your history and progress over time.
- New patients fast: a case creator drafts a full case file from a short form, and a new patient face only needs one photo.
How we built it
- Frontend: React + Vite, with push-to-talk recording, subtitles and a video-call layout.
- Backend (FastAPI): speech-to-text with Whisper (large-v3-turbo on a Mac GPU, base.en on a CPU server). The patient is Claude Opus, kept in one long-lived session per exam so each turn costs only model time. It answers from a case file and persona prompt, and tags every reply with an emotion and a head gesture (
[sad|look_down] ...). A second, faster model grades the exam in the background. - Voice: ElevenLabs eleven_v3, with the patient's emotion turned into audio tags that are performed, not read aloud. Mistral Voxtral TTS takes over if ElevenLabs fails.
- Face: an open-source talking-head model (Ditto) on a TUM lab RTX GPU, reached through a token-protected Cloudflare tunnel.
- It animates a single neutral photo from the voice audio in real time.
- Emotions are expression offsets that morph smoothly from one to the next.
- The lips close in pauses, and head pose and gaze are controllable.
- We added face restoration (GFPGAN) and sharpening for detail.
- Expression photos for each patient come from FLUX.2-klein.
- Webcam emotion: MediaPipe finds the student's face in the browser. A trained classifier (EfficientNet-B0 on AffectNet) compares it with the student's own resting face.
- From releasing Space to the patient starting to speak takes about 3–4 seconds: ~0.3–0.8 s speech recognition, ~1.8 s for Claude, ~1 s for voice and the first video frame.
Challenges we ran into
- Latency: every stage adds delay, and a long pause breaks the illusion. We stream everything: the voice starts playing while it is still being generated, and the face renders faster than real time. The voice waits at most 0.7 s for the first video frame so lips and sound start together.
- A face that looks alive: the first version started each answer with an open mouth and hung open in pauses. Changing emotion looked like a crossfade between two photos (a double image). The fixes: a lip gate driven by the audio, expression morphing from one photo instead of swapping photos, and aligning all expression images.
- Hosted avatars didn't fit: a commercial real-time avatar service needed about 4 hours to build each face, and we had no credits. So we self-hosted an open-source model on university GPUs.
- Shared lab GPUs: another student's training job took over our GPU overnight and halved our frame rate. We learned to check for a free GPU first and to move the renderer quickly.
- Reading emotions: hand-written rules on face landmarks only ever said "smiling" or "concerned" on a real webcam. A trained classifier, calibrated to each student's resting face, fixed it.
- Keeping the patient in character: no invented symptoms, no merged replies, and staying the patient even when asked whether he is an AI.
Accomplishments that we're proud of
- A patient who talks back with a live, lip-synced, emotional face from a single photo, starting about a second after the reply is ready.
- Expressions that change smoothly instead of cutting, with a face that keeps its emotion between answers.
- A patient who keeps his story straight and makes students work for the hidden facts.
- Feedback that shows students exactly which questions they missed.
- Everything degrades gracefully: if the GPU or a voice service goes down, the patient keeps talking.
What we learned
- Realism is mostly in the small things: the mouth closing in pauses, a face that doesn't reset to neutral, expressions that blend.
- Measure everything. Every fix came from frame-by-frame measurements rather than guesses.
- Streaming and staging matter more than raw model speed for a conversation that feels natural.
- Shared infrastructure fails in ways your code can't predict, so build fallbacks.
What's next for Solivea
- More cases: eight are already planned, from chest pressure and racing heart to a lump in the neck and a patient in chemotherapy. Teachers can build more with the case creator.
- Breaking-bad-news scenarios with relatives, not just patients.
- A dedicated GPU instead of shared lab machines, so many students can practise at once.
- Mobile and VR versions, and a richer feedback coach on communication: empathy, eye contact, pace.
Built With
- anthropic
- claude
- cloudflare
- ditto
- elevenlabs
- fastapi
- flux
- gfpgan
- gpu
- huggingface
- javascript
- mediapipe
- mistral
- numpy
- onnxruntime
- opencv
- python
- pytorch
- react
- typescript
- uvicorn
- vite
- voxtral
- websockets
- whisper