QueryGuard is an end-to-end Search Query Anomaly Detection system built with:
- Isolation Forest for anomaly detection
- FastAPI backend for model inference
- Streamlit frontend for UI
- MLflow (local) for tracking experiments (params, metrics, artifacts)
- Create & activate virtual environment
# Windows
python -m venv myenv
myenv\Scripts\activate- Install dependencies
pip install -r requirements-api.txt
pip install -r requirements-frontend.txt
pip install mlflow matplotlib- Train model (optional)
python src/train_mlflow.py- Start backend (FastAPI)
uvicorn api.main:app --reload
Backend docs:
http://127.0.0.1:8000/docs- Start frontend (Streamlit)
streamlit run frontend/app.py
Frontend:
http://127.0.0.1:8501- Pull images
docker pull shreymishr/queryguard-backend:latest
docker pull shreymishr/queryguard-frontend:latest- Run using Docker Compose
#Make sure you have the file docker-compose.prod.yml (present in this repo root).
#From the folder containing it, run:
docker compose -f docker-compose.prod.yml up
- Open in browser
Frontend:
http://localhost:8501
Backend docs:
http://localhost:8000/docs
#To stop
docker compose -f docker-compose.prod.yml down