YENUGU SUJITH REDDY
Initial commit with Git LFS models
45fe8b6
metadata
title: Semantic Search Cache API
emoji: πŸ”Ž
colorFrom: blue
colorTo: purple
sdk: docker
python_version: '3.10'
app_file: app.py
app_port: 7860
pinned: false

Semantic Search Cache API

This project provides a semantic search engine with caching and fuzzy clustering.

It uses:

  • Sentence embeddings
  • FAISS vector index
  • Gaussian Mixture Model clustering
  • Semantic caching

The API is built with FastAPI and deployed using Docker on Hugging Face Spaces.


Features

  • Semantic similarity search
  • FAISS vector indexing
  • Semantic cache for faster repeated queries
  • Fuzzy clustering with GMM
  • REST API endpoints

API Endpoints

POST /query

Example request:

{
  "query": "space shuttle launch",
  "top_k": 5
}

GET /cache/stats

Returns semantic cache statistics.

DELETE /cache

Clears the cache.


Project Structure

semantic-search-cache/
β”‚
β”œβ”€β”€ api/
β”‚   └── main.py
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ query_engine.py
β”‚   β”œβ”€β”€ semantic_cache.py
β”‚   β”œβ”€β”€ fuzzy_cluster.py
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ faiss_index.index
β”‚   β”œβ”€β”€ documents.pkl
β”‚   └── gmm_model.pkl
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Dockerfile
└── app.py

Deployment

This project is deployed using Docker on Hugging Face Spaces.

The container exposes port 7860 and runs a FastAPI server using Uvicorn.