Spaces:
Sleeping
A newer version of the Streamlit SDK is available: 1.62.0
title: Fair Election Reporting RAG Chatbot
emoji: ๐ณ๏ธ
colorFrom: blue
colorTo: indigo
sdk: streamlit
sdk_version: 1.39.0
app_file: RAG์ฑ๋ด_๋ฐฐํฌ.py
pinned: false
license: mit
๐ณ๏ธ Fair Election Reporting Guide RAG Chatbot
This retrieval-augmented generation (RAG) chatbot uses the Internet Election News Deliberation Commission's approximately 105-page 2026 Fair Election Reporting Guide. It finds relevant information in the guide and answers questions with source page numbers.
How to Use
- Select a sample question in the sidebar, or enter your own question in the input field at the bottom.
- Verify the
[ํ์ด์ง N]citation shown with the answer against the original guide. - Ask follow-up questions; the chatbot uses the previous context to respond naturally (multi-turn conversation).
- To start over, click ๐๏ธ ๋ํ ์ด๊ธฐํ in the sidebar.
Technology Stack
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Embedding model | Gemini Embedding 001 (768 dimensions) |
| Vector DB | Chroma (prebuilt persistent store) |
| Generative model | Gemini 2.5 Flash-Lite |
| Deployment | Hugging Face Spaces |
How It Works
์ง๋ฌธ ์
๋ ฅ
โ
Gemini Embedding์ผ๋ก ๋ฒกํฐํ (task_type=retrieval_query)
โ
Chroma DB์์ ์ฝ์ฌ์ธ ์ ์ฌ๋ Top-5 ์ฒญํฌ ๊ฒ์
โ
๊ฒ์ ๊ฒฐ๊ณผ + ์์คํ
ํ๋กฌํํธ + ๋ํ ์ด๋ ฅ โ Gemini 2.5 Flash-Lite
โ
์ถ์ฒ ํ์ด์ง๊ฐ ํ์๋ ํ๊ตญ์ด ๋ต๋ณ ์์ฑ
Environment Variables
Add the following entry under Settings โ Variables and secrets in the Space:
GEMINI_API_KEYโ Obtain from Google AI Studio (https://aistudio.google.com/apikey)
Run Locally
Install the dependencies (a virtual environment is recommended).
pip install -r requirements.txtCreate a
.envfile in the same directory and add the following line.GEMINI_API_KEY=๋ณธ์ธ์_Gemini_API_ํคMake sure the prebuilt
chroma_election_db/directory is in the same location.Run the app with Streamlit rather than invoking Python directly.
streamlit run RAG์ฑ๋ด_๋ฐฐํฌ.pyIf the browser does not open automatically, open http://localhost:8501 in your browser.
File Structure
.
โโโ RAG์ฑ๋ด_๋ฐฐํฌ.py # ๋ฉ์ธ ์ฑ (Streamlit ์ง์
์ )
โโโ requirements.txt # ์์กด ํจํค์ง
โโโ README.md # ์ด ํ์ผ
โโโ chroma_election_db/ # ์ฌ์ ๋น๋๋ ๋ฒกํฐ DB
โโโ chroma.sqlite3
โโโ <UUID ํด๋>/
The vector DB must be generated in advance with a separate build script. The app does not perform chunking or embedding at runtime.
Notes
- The chatbot's answers are based on the guide, but verify the original guide before using them for final decisions or citations.
- On the free tier, the Space may go to sleep after a period of inactivity, so the first request may take approximately 30 seconds.
- Separate usage limits and pricing policies apply to Gemini API calls.