--- title: "USTP Student Handbook Assistant" emoji: "๐Ÿ“˜" colorFrom: "purple" colorTo: "indigo" sdk: "streamlit" sdk_version: "1.39.0" app_file: src/streamlit_app.py pinned: false license: "mit" --- # ๐Ÿ“˜ USTP Student Handbook Assistant (2023 Edition) This Streamlit app lets students, faculty, and staff **ask questions about the USTP Student Handbook (2023 Edition)** and get **accurate, page-referenced answers** directly from the document โ€” powered by **FAISS**, **Sentence Transformers**, and **open-source LLMs** such as Mistral, Mixtral, and Qwen. --- ## ๐Ÿš€ Features โœ… Reads and indexes the *USTP Student Handbook 2023 Edition* PDF โœ… Fast semantic search with **FAISS vector database** โœ… Accurate citation with **printed page numbers**, not raw PDF indices โœ… Choose between **multiple open-source models** (Mistral, Mixtral, Qwen, etc.) โœ… Offline-safe โ€” works even without API tokens โœ… Automatic local embedding with **MiniLM** for fast responses โœ… Caches index for instant re-use --- ## ๐Ÿง  LLM Integration (Optional) You can enhance the assistantโ€™s responses with **Hugging Face Inference API** or run it completely **offline** using local models. ### ๐Ÿ”‘ To configure: 1. Create a `.env` file in the app root directory. 2. Add your Hugging Face token (optional): HF_TOKEN = your_huggingface_token 3. Save the file and **restart the app**. > ๐Ÿ’ก If you donโ€™t provide a token, the app will automatically use a **local SentenceTransformer model** for embeddings. --- ## ๐Ÿ› ๏ธ Deployment Notes - **Runtime:** Python SDK - **SDK:** Streamlit - **App file:** `src/streamlit_app.py` - **PDF file:** Must be named `USTP Student Handbook 2023 Edition.pdf` and placed in the same directory. - **Recommended visibility:** **Public** (for demo and student access) - **Supported models:** - `mistralai/Mistral-7B-Instruct-v0.3` - `mistralai/Mixtral-8x7B-Instruct-v0.1` - `Qwen/Qwen2.5-14B-Instruct` --- ## โš™๏ธ Troubleshooting ### โš ๏ธ โ€œPermission denied: '/.streamlit'โ€ If deploying in a restricted environment: - Set the working directory to a writable path (e.g., `/home/appuser/app`). - Or run: ```bash mkdir -p ~/.streamlit