File size: 1,984 Bytes
5830d4e
aea1de2
 
 
 
5830d4e
aea1de2
5830d4e
 
 
 
aea1de2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: P3 Myeloma Follow-up Chatbot
emoji: 🩺
colorFrom: red
colorTo: gray
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
---

# P3 Myeloma – AI Follow-up Chatbot

An adaptive follow-up chatbot for the AI-Enhanced Personalized Patient Profile (P3)
Myeloma intake. The participant answers the 16 Shared Decision Making questions, and
the app uses Google Gemini to ask tailored follow-up questions, gently probe apparent
contradictions in their preferences, and end with a priorities summary they can bring
to their care team.

It does **not** give medical advice, diagnoses, or treatment recommendations. It only
helps the patient articulate their own values and concerns.

## Setup on Hugging Face Spaces

1. Create a new Space, choose **Gradio** as the SDK.
2. Upload `app.py`, `requirements.txt`, and this `README.md`.
3. Add your Gemini key as a secret:
   - Go to **Settings → Variables and secrets → New secret**
   - Name: `GEMINI_API_KEY`
   - Value: your key from https://aistudio.google.com/apikey
4. The Space will build and launch automatically.

If you do not set the secret, users can paste a key in the collapsible
"Gemini API Key" field in the UI.

## Model

Uses `gemini-2.5-flash`. To change it, edit the `MODEL` variable in `app.py`.

## How it works

- The 16 yes/no answers are turned into a structured profile.
- A rule-based `detect_tensions()` step flags likely contradictions (for example,
  wanting an aggressive approach while prioritizing quality of life, or living alone
  with no caregiver but preferring home medications).
- Those flags are passed to Gemini, which asks one follow-up question per turn.
- After enough exchanges (capped at 8), the model returns a `<<SUMMARY>>` of the
  patient's priorities, which the app formats and displays.

## Disclaimer

This tool is for informational and preparation purposes only and is not a substitute
for professional medical advice. Always consult a qualified healthcare provider.