Spaces:
Sleeping
Sleeping
updating readme
Browse files
README.md
CHANGED
|
@@ -9,41 +9,62 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
2. Install the required dependencies:
|
| 22 |
-
```bash
|
| 23 |
-
pip install -r requirements.txt
|
| 24 |
-
```
|
| 25 |
-
3. Set up your Hugging Face token as an environment variable:
|
| 26 |
-
```bash
|
| 27 |
-
export HF_TOKEN=your_token_here
|
| 28 |
-
```
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
streamlit run app.py
|
| 35 |
-
```
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
2. Choose Streamlit as the SDK
|
| 41 |
-
3. Upload these files to your Space
|
| 42 |
-
4. Add your Hugging Face token as a secret in the Space settings
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
-
|
| 47 |
-
- Powered by DeepSeek R1 1.5B model
|
| 48 |
-
- Efficient inference using llama_cpp
|
| 49 |
-
- Persistent chat history during the session
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Boston Public Schools Enrollment Assistant Chatbot
|
| 13 |
|
| 14 |
+
This is a Streamlit-based conversational chatbot designed to assist families in navigating the Boston Public Schools (BPS) enrollment process. It uses a local language model (Gemma-2B via llama-cpp) combined with Retrieval-Augmented Generation (RAG) and external APIs to answer questions about school eligibility, required documents, and nearby schools based on user-provided information.
|
| 15 |
|
| 16 |
+
## Features
|
| 17 |
|
| 18 |
+
* **Conversational Interface:** Ask questions naturally about BPS enrollment.
|
| 19 |
+
* **Context Tracking:** Remembers information provided during the conversation (residence, grade, etc.) using a JSON structure.
|
| 20 |
+
* **Document Retrieval (RAG):** Uses information from local text files (in the `docs/` directory) containing BPS rules and regulations to answer questions accurately.
|
| 21 |
+
* **Nearby School Lookup:** Uses the Geoapify API to find schools near a provided Boston residence address.
|
| 22 |
+
* **Local LLM:** Runs inference locally using `llama-cpp-python` with a quantized Gemma-2B GGUF model, suitable for CPU execution on platforms like Hugging Face Spaces free tier.
|
| 23 |
|
| 24 |
+
## Technology Stack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
* **Frontend:** Streamlit
|
| 27 |
+
* **LLM Inference:** `llama-cpp-python`
|
| 28 |
+
* **LLM Model:** `bartowski/gemma-2-2b-it-GGUF` (Q8_0 quantization)
|
| 29 |
+
* **Embeddings:** `sentence-transformers` (`all-MiniLM-L6-v2`)
|
| 30 |
+
* **Vector Store:** FAISS (CPU)
|
| 31 |
+
* **Geocoding/Places API:** Geoapify
|
| 32 |
+
* **Core Language:** Python 3
|
| 33 |
|
| 34 |
+
## Setup and Installation (for Hugging Face Spaces)
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
1. **Repository Files:** Ensure the following files are present in your Hugging Face Space repository:
|
| 37 |
+
* `app.py`: The main Streamlit application script.
|
| 38 |
+
* `requirements.txt`: Lists all Python dependencies.
|
| 39 |
+
* `prompts.py`: Contains the prompt strings for the LLM.
|
| 40 |
+
* `docs/`: A directory containing `.txt` files with BPS enrollment information used for RAG. **You must create this directory and add the relevant text files.**
|
| 41 |
+
* `.streamlit/secrets.toml`: (Optional but recommended) For storing API keys.
|
| 42 |
|
| 43 |
+
2. **Dependencies:** The `requirements.txt` file ensures all necessary packages are installed automatically by Hugging Face Spaces.
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
3. **`docs/` Directory:** Create a directory named `docs` in the root of your repository. Place all the `.txt` files containing the Boston Public Schools information you want the chatbot to reference inside this directory. The RAG system relies on these files.
|
| 46 |
+
|
| 47 |
+
4. **API Keys:**
|
| 48 |
+
* **Geoapify:** You need a Geoapify API key for the geocoding and nearby school lookup features.
|
| 49 |
+
* Create a file named `secrets.toml` inside a directory named `.streamlit` in your repository (i.e., `.streamlit/secrets.toml`).
|
| 50 |
+
* Add your Geoapify key to this file:
|
| 51 |
+
```toml
|
| 52 |
+
# .streamlit/secrets.toml
|
| 53 |
+
GEOAPIFY_KEY = "YOUR_ACTUAL_GEOAPIFY_API_KEY_HERE"
|
| 54 |
+
|
| 55 |
+
# Optional: Add Hugging Face Token if needed for model downloads
|
| 56 |
+
# HF_TOKEN = "YOUR_HUGGINGFACE_TOKEN_HERE"
|
| 57 |
+
```
|
| 58 |
+
* **Note:** Protect your API keys. `secrets.toml` is generally included in `.gitignore` for local development but is read by Streamlit Cloud and Hugging Face Spaces when deployed.
|
| 59 |
+
|
| 60 |
+
## Running the Application
|
| 61 |
+
|
| 62 |
+
This application is designed to be deployed on Hugging Face Spaces. Once the files (`app.py`, `requirements.txt`, `prompts.py`, `docs/` directory, `.streamlit/secrets.toml`) are correctly set up in the repository, Hugging Face Spaces should automatically build and run the Streamlit application.
|
| 63 |
+
|
| 64 |
+
## Usage
|
| 65 |
+
|
| 66 |
+
Interact with the chatbot by typing your questions into the input box at the bottom of the application. Provide information like your address or your child's grade when asked, and the chatbot will use this context, along with retrieved documents and external lookups, to assist you.
|
| 67 |
+
|
| 68 |
+
## Disclaimer
|
| 69 |
|
| 70 |
+
This chatbot aims to provide helpful information based on the documents provided in the `docs/` directory and external APIs. However, **Boston Public Schools enrollment rules and policies can change.** Always verify critical information directly with official BPS resources or a BPS Welcome Center before making decisions. The information provided by this chatbot is not guaranteed to be 100% accurate or up-to-date and should be used as a guide only.
|
|
|
|
|
|
|
|
|