Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Web-Based Q&A Tool enables users to extract and query website content using FastAPI, FAISS, and a local TinyLlama-1.1B model—without external APIs. Built with React, it offers a minimal UI for seamless AI-driven search

Notifications You must be signed in to change notification settings

ksm26/Web-Based-Q-A-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

5 Commits

Repository files navigation

🌐 Web-Based Q&A Tool

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.


🚀 Features

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

📂 Project Structure

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


🛠️ Tech Stack

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)

🚀 Setup Instructions

1️⃣ Clone the Repository

git clone https://github.com/your-username/web_based_QA.git
cd web_based_QA

2️⃣ Install Dependencies

cd backend
pip install -r requirements.txt

3️⃣ Download a Local LLM Model (TinyLlama)

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

4️⃣ Start the Backend

cd backend
uvicorn app:app --reload --host 0.0.0.0 --port 8000

🎨 Frontend Setup (React)

5️⃣ Install Dependencies

cd frontend
npm install

6️⃣ Start the React App

npm start

🌍 Usage

7️⃣ Ingest a Webpage

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!"}

8️⃣ Ask a Question

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..."}

🚀 Deployment

Backend Deployment

gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app

Frontend Production Build

cd frontend
npm run build

About

Web-Based Q&A Tool enables users to extract and query website content using FastAPI, FAISS, and a local TinyLlama-1.1B model—without external APIs. Built with React, it offers a minimal UI for seamless AI-driven search

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /