Spaces:
Sleeping
Sleeping
README.md update
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: π³οΈ
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
|
@@ -10,30 +10,30 @@ pinned: false
|
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# π³οΈ
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
**
|
| 18 |
|
| 19 |
-
##
|
| 20 |
|
| 21 |
-
1.
|
| 22 |
-
2.
|
| 23 |
-
3.
|
| 24 |
-
4.
|
| 25 |
|
| 26 |
-
##
|
| 27 |
|
| 28 |
-
|
|
| 29 |
|---|---|
|
| 30 |
-
|
|
| 31 |
-
|
|
| 32 |
-
|
|
| 33 |
-
|
|
| 34 |
-
|
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
```
|
| 39 |
μ§λ¬Έ μ
λ ₯
|
|
@@ -47,37 +47,37 @@ Chroma DBμμ μ½μ¬μΈ μ μ¬λ Top-5 μ²ν¬ κ²μ
|
|
| 47 |
μΆμ² νμ΄μ§κ° νμλ νκ΅μ΄ λ΅λ³ μμ±
|
| 48 |
```
|
| 49 |
|
| 50 |
-
##
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
- `GEMINI_API_KEY` β Google AI Studio
|
| 55 |
|
| 56 |
-
##
|
| 57 |
|
| 58 |
-
1.
|
| 59 |
|
| 60 |
```bash
|
| 61 |
pip install -r requirements.txt
|
| 62 |
```
|
| 63 |
|
| 64 |
-
2.
|
| 65 |
|
| 66 |
```
|
| 67 |
GEMINI_API_KEY=λ³ΈμΈμ_Gemini_API_ν€
|
| 68 |
```
|
| 69 |
|
| 70 |
-
3.
|
| 71 |
|
| 72 |
-
4.
|
| 73 |
|
| 74 |
```bash
|
| 75 |
streamlit run RAGμ±λ΄_λ°°ν¬.py
|
| 76 |
```
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
##
|
| 81 |
|
| 82 |
```
|
| 83 |
.
|
|
@@ -89,11 +89,11 @@ Spaceμ **Settings β Variables and secrets**μ μλ νλͺ© λ±λ‘ νμ:
|
|
| 89 |
βββ <UUID ν΄λ>/
|
| 90 |
```
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
-
##
|
| 96 |
|
| 97 |
-
-
|
| 98 |
-
-
|
| 99 |
-
-
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Fair Election Reporting RAG Chatbot
|
| 3 |
emoji: π³οΈ
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
|
|
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# π³οΈ Fair Election Reporting Guide RAG Chatbot
|
| 14 |
|
| 15 |
+
This retrieval-augmented generation (RAG) chatbot uses the Internet Election News
|
| 16 |
+
Deliberation Commission's approximately 105-page **2026 Fair Election Reporting Guide**.
|
| 17 |
+
It finds relevant information in the guide and answers questions **with source page numbers**.
|
| 18 |
|
| 19 |
+
## How to Use
|
| 20 |
|
| 21 |
+
1. Select a sample question in the sidebar, or enter your own question in the input field at the bottom.
|
| 22 |
+
2. Verify the `[νμ΄μ§ N]` citation shown with the answer against the original guide.
|
| 23 |
+
3. Ask follow-up questions; the chatbot uses the previous context to respond naturally (multi-turn conversation).
|
| 24 |
+
4. To start over, click **ποΈ λν μ΄κΈ°ν** in the sidebar.
|
| 25 |
|
| 26 |
+
## Technology Stack
|
| 27 |
|
| 28 |
+
| Component | Technology |
|
| 29 |
|---|---|
|
| 30 |
+
| Frontend | Streamlit |
|
| 31 |
+
| Embedding model | Gemini Embedding 001 (768 dimensions) |
|
| 32 |
+
| Vector DB | Chroma (prebuilt persistent store) |
|
| 33 |
+
| Generative model | Gemini 2.5 Flash-Lite |
|
| 34 |
+
| Deployment | Hugging Face Spaces |
|
| 35 |
|
| 36 |
+
## How It Works
|
| 37 |
|
| 38 |
```
|
| 39 |
μ§λ¬Έ μ
λ ₯
|
|
|
|
| 47 |
μΆμ² νμ΄μ§κ° νμλ νκ΅μ΄ λ΅λ³ μμ±
|
| 48 |
```
|
| 49 |
|
| 50 |
+
## Environment Variables
|
| 51 |
|
| 52 |
+
Add the following entry under **Settings β Variables and secrets** in the Space:
|
| 53 |
|
| 54 |
+
- `GEMINI_API_KEY` β Obtain from Google AI Studio (https://aistudio.google.com/apikey)
|
| 55 |
|
| 56 |
+
## Run Locally
|
| 57 |
|
| 58 |
+
1. Install the dependencies (a virtual environment is recommended).
|
| 59 |
|
| 60 |
```bash
|
| 61 |
pip install -r requirements.txt
|
| 62 |
```
|
| 63 |
|
| 64 |
+
2. Create a `.env` file in the same directory and add the following line.
|
| 65 |
|
| 66 |
```
|
| 67 |
GEMINI_API_KEY=λ³ΈμΈμ_Gemini_API_ν€
|
| 68 |
```
|
| 69 |
|
| 70 |
+
3. Make sure the prebuilt `chroma_election_db/` directory is in the same location.
|
| 71 |
|
| 72 |
+
4. Run the app with Streamlit rather than invoking Python directly.
|
| 73 |
|
| 74 |
```bash
|
| 75 |
streamlit run RAGμ±λ΄_λ°°ν¬.py
|
| 76 |
```
|
| 77 |
|
| 78 |
+
If the browser does not open automatically, open http://localhost:8501 in your browser.
|
| 79 |
|
| 80 |
+
## File Structure
|
| 81 |
|
| 82 |
```
|
| 83 |
.
|
|
|
|
| 89 |
βββ <UUID ν΄λ>/
|
| 90 |
```
|
| 91 |
|
| 92 |
+
The vector DB must be generated in advance with a separate build script.
|
| 93 |
+
The app does not perform chunking or embedding at runtime.
|
| 94 |
|
| 95 |
+
## Notes
|
| 96 |
|
| 97 |
+
- The chatbot's answers are based on the guide, but verify the **original guide** before using them for final decisions or citations.
|
| 98 |
+
- On the free tier, the Space may go to sleep after a period of inactivity, so the first request may take approximately 30 seconds.
|
| 99 |
+
- Separate usage limits and pricing policies apply to Gemini API calls.
|