CoolFace
Apppublic

Vancey/USTP_HB

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes
App README

πŸŽ“ USTP Handbook Chatbot (Streamlit)

This Hugging Face Space hosts an intelligent chatbot that answers student queries using the USTP Student Handbook (2021 Edition) as its knowledge base.

Built for the University of Science and Technology of Southern Philippines (USTP) students, this chatbot provides fast, accurate, and context-aware responses based on official handbook content.


🧠 Overview

The USTP Handbook Chatbot uses:

  • β€”PDF text extraction (via PyPDF2)
  • β€”Semantic search (via sentence-transformers + FAISS)
  • β€”Generative AI (via the Perplexity AI API)

This setup allows the model to retrieve relevant sections from the handbook and generate concise, grounded answers β€” using a retrieval-augmented generation (RAG) pipeline.


βš™οΈ Tech Stack

ComponentDescription
🧠 Model BackendPerplexity AI API (sonar-pro, sonar, or sonar-lite)
πŸ’¬ App FrameworkStreamlit
πŸ” Semantic SearchSentenceTransformer (all-MiniLM-L6-v2) + FAISS
πŸ“˜ HandbookSTUDENT-HANDBOOK-2021-EDITION.pdf
🧩 LanguagePython 3.10+
πŸͺΆ LicenseApache 2.0

πŸš€ How to Use

  1. 1.Open this Hugging Face Space.
  2. 2.The app automatically loads and indexes the USTP Handbook PDF.
  3. 3.Type any question about student policies, rights, or rules.
  4. 4.The chatbot retrieves relevant context and generates an answer.

Example:

πŸ’¬ β€œWhat is the proper dress code for students at USTP?”

βœ… Returns the related section from the handbook and a summarized explanation.


πŸ” API Setup (for Perplexity)

To enable Perplexity AI integration:

  1. 1.Go to your Space’s Settings β†’ Repository secrets.
  2. 2.Add the following key:
  3. 3.Paste your actual API key as the value.
  4. 4.Save the secret β€” it will load automatically at runtime.

πŸ“‚ File Structure

FileDescription
app.pyMain Streamlit application
handbook_utils.pyPDF loader, chunker, FAISS search, and prompt builder
requirements.txtPython dependencies
STUDENT-HANDBOOK-2021-EDITION.pdfUSTP 2021 official student handbook
README.mdThis documentation file

πŸ–₯️ Run Locally (Optional)

If you want to test it locally before pushing to Hugging Face:

bash
git clone https://huggingface.co/spaces/Vancey/USTP_HB
cd USTP_HB
pip install -r requirements.txt
streamlit run app.py