Cchangyu's picture
README.md update
7ae0094
|
Raw
History Blame Contribute Delete
3.08 kB

A newer version of the Streamlit SDK is available: 1.62.0

Upgrade
metadata
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

  1. Select a sample question in the sidebar, or enter your own question in the input field at the bottom.
  2. Verify the [ํŽ˜์ด์ง€ N] citation shown with the answer against the original guide.
  3. Ask follow-up questions; the chatbot uses the previous context to respond naturally (multi-turn conversation).
  4. 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:

Run Locally

  1. Install the dependencies (a virtual environment is recommended).

    pip install -r requirements.txt
    
  2. Create a .env file in the same directory and add the following line.

    GEMINI_API_KEY=๋ณธ์ธ์˜_Gemini_API_ํ‚ค
    
  3. Make sure the prebuilt chroma_election_db/ directory is in the same location.

  4. Run the app with Streamlit rather than invoking Python directly.

    streamlit run RAG์ฑ—๋ด‡_๋ฐฐํฌ.py
    

    If 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.