Skip to content

AI-powered article recommender using sentence embeddings and FAISS for semantic search. Includes a FastAPI backend and Streamlit frontend.

Notifications You must be signed in to change notification settings

reinelt88/semantic-recommender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 Semantic Article Recommender

This project is an end-to-end system that recommends similar articles based on semantic similarity, using:

  • ✅ Hugging Face sentence embeddings
  • ✅ FAISS vector search
  • ✅ FastAPI backend
  • ✅ Streamlit frontend

A hands-on project for learning and applying modern recommendation techniques powered by sentence embeddings.


📦 Features

  • Generate and store vector embeddings with sentence-transformers
  • Search for semantically similar articles using FAISS
  • REST API with FastAPI (/recommend)
  • Frontend built in Streamlit for quick interaction
  • Dataset simulated for demo purposes

🧠 Technologies Used


📁 Project Structure

semantic-recommender/
├── app/                  # FastAPI backend
│   ├── main.py
│   ├── model.py
│   └── schemas.py
├── recommender/          # Dataset + indexer
│   ├── articles.csv
│   └── build_index.py
├── index/                # FAISS vector store
│   ├── faiss_index.bin
│   └── articles.csv
├── streamlit_app/        # Streamlit UI
│   └── app.py
├── requirements.txt
└── README.md

🚀 How to Run

  1. Install dependencies
pip install -r requirements.txt
  1. Build FAISS index
python recommender/build_index.py
  1. Run FastAPI backend
uvicorn app.main:app --reload
  1. Run Streamlit app (in another terminal)
streamlit run streamlit_app/app.py

🔎 API Example

GET /recommend

Query similar articles based on a text prompt.

Request:

GET /recommend?q=how to sleep better&k=3

Response:

{
  "query": "how to sleep better",
  "results": [
    {
      "title": "10 Tips for Better Sleep",
      "description": "Simple changes that can dramatically improve your rest.",
      "category": "health"
    },
    ...
  ]
}

🧪 Sample Queries

Try these in the UI or via API:

  • "tips for better health"
  • "remote work apps"
  • "investing in 2025"
  • "learn programming"
  • "how to travel in Europe"

🖼️ Screenshots

Chat Response

Follow on GitHub

About

AI-powered article recommender using sentence embeddings and FAISS for semantic search. Includes a FastAPI backend and Streamlit frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages