All Projects

PHAI.

Upload a prescription, get it explained back — a fine-tuned T5 model that answers questions about your own medication.

Generative AI & LLMsArchived — coursework buildFine-tuned T55 supportedStreamlit chatEnglish · Arabic
5
Medicines covered
25
Fine-tune epochs
200
Summarizer epochs
5
Beam search width

Overview

Problem

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.

How it works

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.

Origin

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.

  1. 01
    Pick medicine

    one of 5, EN or AR PDF

  2. 02
    Summarize

    T5, beam search, highlights

  3. 03
    Ask

    T5 Q&A over the full prescription text

Stack

T5 (flan-t5-large)fine-tuned Q&A + summarizationStreamlitmedicine picker + chat UIHuggingFace TransformersSeq2Seq training + inferenceROUGE (evaluate)summarization eval harness

Reproduce it

Local
$ git clone https://github.com/baselhusam/phai.git
$ pip install -r requirements.txt
$ streamlit run main.py