ghostai1's picture
Update README.md
f24b473 verified

A newer version of the Gradio SDK is available: 5.42.0

Upgrade
metadata
title: Sentence Transformers
emoji: πŸ“š
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Small CNN

πŸ” MiniLM Semantic FAQ Search β€” Smart, Lightning-Fast Knowledge Retrieval

Hugging Face Space Gradio UI Model License


πŸš€ TL;DR

Ask a question β†’ get the three most relevant answers from a curated FAQ β€” all in real time on a free CPU-only Hugging Face Space.
Powered by the all-MiniLM-L6-v2 sentence-transformer (∼90 MB, < 1 GB RAM) and a minimalist Gradio 5 UI.


✨ Why You’ll Love It

Β· Capability Why It Matters
⚑ Instant Retrieval 50-200 ms response time even on CPU-only hardware.
🧠 Semantic Matching Goes beyond keywords; understands intent and phrasing.
πŸ“ˆ Live Similarity Scores Transparent confidence metrics for every hit.
πŸŽ›οΈ Interactive Slider Choose 1-5 results in a single drag.
🎨 Sleek Gradio GUI No setup friction β€” just open a browser and explore.
πŸ’Έ Free-Tier Friendly Fits comfortably inside Hugging Face Spaces’ 2 vCPU / 16 GB RAM limit.
πŸ› οΈ Drop-in Dataset Swap Replace faqs.csv with thousands of your own Q-A pairs β€” no retraining required.

πŸ—οΈ How It Works

  1. Vectorisation
    Every FAQ question is embedded with sentence-transformers/all-MiniLM-L6-v2 into a 384-dimensional vector (done once at start-up).

  2. Inference
    A user query is embedded on the fly and cosine-compared with all FAQ vectors via πŸ€— util.cos_sim.

  3. Ranking
    Top-k indices are extracted with PyTorch’s efficient topk, then mapped back to the original FAQ rows.

  4. Presentation
    Gradio displays the question, answer and similarity score in a responsive dataframe.

No database, no external search engine, just straight Python & PyTorch embeddings.


πŸ–₯️ Quick Start (Local Dev, Optional)

git clone https://github.com/your-username/minilm-semantic-search.git
cd minilm-semantic-search
python -m venv venv && source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py