A simple web application that allows users to:
✅ Ingest website content by providing URLs.
✅ Ask questions based strictly on the ingested content.
✅ Get concise, AI-generated answers without using external knowledge.
- Web Scraping: Extracts text content from webpages.
- Embeddings & Retrieval: Uses FAISS for fast search.
- Local LLM Support: Runs AI-based Q&A without OpenAI API.
- Minimal UI: Built with React for easy interaction.
web_based_QA/
│── backend/ # FastAPI backend
│ ├── app.py # Main API
│ ├── scraper.py # Web scraping logic
│ ├── embeddings.py # FAISS index & text embeddings
│ ├── model.py # Local LLM for Q&A
│ ├── requirements.txt # Backend dependencies
│── frontend/ # React frontend
│ ├── src/
│ │ ├── App.js # Main UI component
│ │ ├── api.js # Axios API calls
│ │ ├── index.css # Minimal UI styles
│ ├── package.json # Frontend dependencies
│── README.md # Documentation
Component | Technology Used |
---|---|
Backend | FastAPI, FAISS, Sentence Transformers, Llama.cpp |
Frontend | React, Axios, JavaScript |
Scraping | BeautifulSoup, Requests, Selenium (for JS-heavy pages) |
LLM | TinyLlama-1.1B (GGUF format) |
git clone https://github.com/your-username/web_based_QA.git
cd web_based_QA
cd backend
pip install -r requirements.txt
mkdir -p models
cd models
wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
cd backend
uvicorn app:app --reload --host 0.0.0.0 --port 8000
cd frontend
npm install
npm start
curl -X POST "http://127.0.0.1:8000/ingest" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.un.org/en/observances/international-nowruz-day"}'
📌 Expected Response:
{"message": "Content ingested successfully!"}
curl -X POST "http://127.0.0.1:8000/ask" \
-H "Content-Type: application/json" \
-d '{"question": "What is International Nowruz Day?"}'
📌 Expected Response:
{"answer": "International Nowruz Day celebrates the Persian New Year, observed on March 21st..."}
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app
cd frontend
npm run build