Spaces:
Sleeping
Sleeping
File size: 3,097 Bytes
0d46365 07d65c3 0d46365 07d65c3 0d46365 07d65c3 0d46365 07d65c3 119a6f0 07d65c3 f289ff0 07d65c3 f289ff0 07d65c3 | 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | ---
title: Aphaea
emoji: 🌙
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 5.38.2
app_file: app.py
pinned: false
license: mit
---
# Aphaea
Aphaea is a cycle-aware reproductive-health education assistant. It combines
semantic retrieval with an instruction-tuned language model to answer questions
using a small, traceable source library.
> Aphaea provides general education, not diagnosis or medical care. It does not
> replace a clinician, pharmacist, or emergency service.
## What changed in the rebuild
- Connected semantic retrieval to the generation pipeline.
- Added inline source labels and clickable source details.
- Replaced fixed phase claims with a transparent calendar-day estimate.
- Added input validation, configuration errors, and model-service fallbacks.
- Removed collection of names and exact ages.
- Rebuilt the interface for a clearer desktop and mobile experience.
- Added authoritative summaries from CDC, ACOG, the Office on Women's Health,
and a peer-reviewed exercise meta-analysis.
## Architecture
1. Source summaries are loaded from `knowledge/sources.json`.
2. `all-MiniLM-L6-v2` embeds each passage and the user's question.
3. Cosine similarity selects the four most relevant passages.
4. Qwen 2.5 Instruct receives the question, optional session profile, and retrieved context.
5. The response must cite the supplied passages as `[S1]`, `[S2]`, and so on.
## Run locally
Python 3.10 or newer is recommended.
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python app.py
```
Add a Hugging Face read token to `.env` as `HF_TOKEN`. Never commit `.env`.
The interface and retrieval can be inspected without a token; generation will
show a configuration message until the secret is present.
## Hugging Face deployment
Create a Space secret named `HF_TOKEN`. The application reads it at runtime.
Do not place the token in `README.md`, `app.py`, or the Git history.
## Knowledge-source policy
Every active passage must include a stable identifier, title, public URL, review
date, and concise paraphrase. Prefer government health agencies, professional
medical bodies, and peer-reviewed systematic reviews. Re-review health passages
before major releases.
## Limitations
- Retrieval quality is not yet clinically evaluated.
- The current corpus is intentionally small.
- Calendar estimates cannot confirm ovulation or hormonal phase.
- Generated answers can still be incomplete or wrong and require evaluation.
## Evaluation and release history
The [`evaluation`](evaluation/) folder contains a 30-prompt fixed test library,
scoring rubric, run log, and formula-driven dashboard. Use the same prompts for
every release so measured changes are comparable. See [`CHANGELOG.md`](CHANGELOG.md)
for the product history and verification record.
## Roadmap
- Run and score the first versioned baseline evaluation.
- Add automated tests for source coverage and safety behavior.
- Conduct accessibility and mobile-layout audits.
- Publish measured results before making accuracy claims.
|