PHAI.
Upload a prescription, get it explained back — a fine-tuned T5 model that answers questions about your own medication.
Overview
Prescriptions are dense; patients still have questions
PHAI covers five common medicines (amoclan, flagyl, nexium, panadol, taskine). For each one it shows the original prescription — in English or Arabic — a summarized/highlighted version, and a chat box for follow-up questions like dosage, side effects, or purpose.
A fine-tuned T5 model, not retrieval
Rather than RAG with embeddings and a vector store, PHAI fine-tunes a T5 sequence-to-sequence model directly on a CSV of prescription Q&A pairs (25 epochs, batch size 8, lr 3e-4), then answers new questions by stuffing the full static prescription text into the prompt as context.
A separate T5 pipeline handles summarization — 200 epochs at lr 5e-5, decoding with 5-way beam search — to produce the highlighted, easier-to-read version of each prescription.
Built for a Deep Learning course at the University of Jordan
Supervised by Dr. Tamam Alsarhan. It's a coursework project rather than a production deployment — the five medicines and their prescription text are static files bundled with the app, not a general document-ingestion pipeline.
Method
Each of five medicines ships with its own static prescription text. A fine-tuned T5 model answers questions by taking the full prescription as context stuffed directly into the prompt — not retrieval, a direct context injection.
- 01Pick medicine
one of 5, EN or AR PDF
- 02Summarize
T5, beam search, highlights
- 03Ask
T5 Q&A over the full prescription text
Stack
Reproduce it
$ git clone https://github.com/baselhusam/phai.git$ pip install -r requirements.txt$ streamlit run main.py