--- title: Alz Multimodal Dynamic Linguistic Chatbot emoji: πŸ“‰ colorFrom: blue colorTo: gray sdk: gradio sdk_version: 5.42.0 app_file: app.py pinned: false license: mit short_description: Multimodal Linguistic Chatbot for AD patients --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference # Alzheimer’s AI Companion (RAG + Role-Aware) A gentle Retrieval-Augmented Generation (RAG) assistant for Alzheimer’s care contexts, with **patient** vs **caregiver** role routing, optional speech-to-text (STT) and text-to-speech (TTS), and a **Gradio** UI suitable for a Hugging Face Space. ## Features - **Role-aware prompting**: simple, comforting tone for *patient*; concise, actionable tone for *caregiver*. - **RAG** over your uploaded documents using FAISS + Sentence-Transformers. - **OpenAI LLM** via `langchain_openai.ChatOpenAI`. - **STT** using OpenAI (`gpt-4o-transcribe` or `whisper-1`), and **TTS** via `gTTS`. - **Gradio UI** with tabs: *Chat*, *Upload Knowledge*, *Settings*. > βš•οΈ This is **not** medical advice, nor a diagnostic tool. Always consult clinicians for health decisions. ## Quickstart (Local) 1. **Install** ```bash pip install -r requirements.txt ``` 2. **Environment** ```bash export OPENAI_API_KEY=YOUR_KEY_HERE ``` 3. **Run** ```bash python app.py ``` Gradio will print a local URL. ## Hugging Face Space Upload the repo (including `app.py` and `requirements.txt`) to a new **Gradio** Space. Set a **secret** named `OPENAI_API_KEY` under *Settings β†’ Variables*. ## Project Layout ``` . β”œβ”€β”€ app.py # Gradio UI β”œβ”€β”€ requirements.txt β”œβ”€β”€ README.md β”œβ”€β”€ sample_data/ β”‚ └── caregiving_tips.txt # Example doc for indexing └── alz_companion/ β”œβ”€β”€ agent.py # Core RAG + role routing + audio helpers └── prompts.py # System & RAG prompts ``` ## Notes - First run will download the embedding model (`sentence-transformers/all-MiniLM-L6-v2`). - FAISS index persists in `data/faiss_index`. Delete that folder to rebuild. - `gTTS` requires outbound Internet access to fetch the voice. ## Licence MIT