mohamedabbouda/confidence-qa-demo
0
๐ Confidence-Based Document QA Extraction with Feedback Logging and Web Demo
This project is a prototype question answering (QA) system built as part of an internship technical task. It uses a pre-trained Hugging Face extractive QA model to answer questions from document-like text. The system includes confidence-based filtering, feedback logging, and an interactive Gradio web app.
๐ Features
- Extracts answers from text using a pre-trained BERT QA model
- Returns answer + confidence score
- Flags low-confidence predictions (default threshold =
0.75) - Saves flagged outputs to
feedback_log.jsonl - Allows manual corrections โ stored in
corrected_data.jsonl - Web interface (Gradio) for interactive testing and corrections
๐ Project Structure
confidence_qa/
โโโ app.py # Web app (Gradio)
โโโ qa_pipeline.py # Backend QA pipeline with threshold + logging
โโโ test_model.py # Quick test script
โโโ requirements.txt # Dependencies
โโโ feedback_log.jsonl # Auto-generated flagged outputs
โโโ corrected_data.jsonl # Manually corrected answers
โโโ README.md # Project documentationโ๏ธ Installation & Setup
- Clone the repo:
git clone https://github.com/alex-dev/confidence_qa.git
cd confidence_qa- Create and activate virtual environment:
python -m venv .venv
source .venv/bin/activate # macOS/Linux - Install dependencies:
pip install -r requirements.txtโ๏ธ Run pipeline (generate feedback logs)
python qa_pipeline.py
โ๏ธ Run web app
python app.pyโ๏ธ ๐ Example
Context:
The Eiffel Tower is in Paris. It was completed in 1889.
Question:
When was the Eiffel Tower completed?Output:
Answer: 1889
Confidence: 0.92
Flagged: False